From: | Patrick Roberts |
Date: | 1 Sep 2000 at 02:56:50 |
Subject: | Re: AMIOPEN: NO MORE "SLEEP 1"!!!! |
Deryk Robosson wrote:
>
> eww..that's more ugly than the sleep(1); :)
>
It may seem like it at first, but here's what I'm thinking the AVE object
values are:
ip+64 is some sort of pointer to another object, possibly the
main AVE window. It's always NULL when AVE hasn't been initialized
then stays constant throughout the session for any program.
ip+52 I'm guessing is a counter that tracks ID numbers for AVO
target objects. The main window must create 9 target AVOs. Each
time an application creates another target AVO this number goes up.
If you close an app and relaunch it, this number continues to go up
and never seems to go down when AVOs are destroyed.
So basically, it's:
Is there a pointer to the main window?
YES: Continue
NO: Wait until the background process creates all 9 of the
main window targets before going on.
The only ugly side effect is that as the AVE versions change, there may be
more or less than 9 targets allocated...but it's about 400 times faster on my
machine than "sleep 1".
-Pat
> ----- Original Message -----
> From: artix <artix@pacbell.net>
> To: <open@amiga.com>
> Sent: Thursday, August 31, 2000 5:27 PM
> Subject: AMIOPEN: NO MORE "SLEEP 1"!!!!
>
> >
> > OK.. it's still a bit of a hack, but not as ugly as the
> > 'system("sleep 1")' thing I was using. Here's the code I'm using now in
> > Ewinease to check AVE init and wait if not ready:
> >
> > ---------------------------------------------------------------
> >
> > #include <unistd.h>
> > int *ip;
> > kn_dev_lookup(buf, &aveinst, &argv0);
> > app = ave_open(aveinst,argv0, 0, 0);
> >
> > /* WAIT FOR AVE WINDOW TO INIT IF NOT ALREADY STARTED */
> >
> > ip=(unsigned int *)__EWE_INITPTRS.aveinst;
> > if(*(ip+64)==0) while (*(ip+52)<9) usleep(10000);
> >
> > /* CONTINUE ON */
>
> Subscribe/Unsubscribe: open-request@amiga.com
> Amiga FAQ: http://www.amiga.com/faq.html
Subscribe/Unsubscribe: open-request@amiga.com
Amiga FAQ: http://www.amiga.com/faq.html