Re(2): Giving time for async notifiers
Re(2): Giving time for async notifiers
- Subject: Re(2): Giving time for async notifiers
- From: Jens Bauer <email@hidden>
- Date: Sat, 9 Feb 2002 01:03:54 +0100
Hi everyone,
On Thu, 7 Feb, 2002, Eric Gundrum <email@hidden> wrote:
>
--- At 6:09 PM +1100 2/7/02, Richard.Fox wrote:
>
>Is there a way that I can pause my
>
>processing to give time for notifiers to fire? At the moment we use
>
>WaitNextEvent (which also gives time to the GUI).
>
>
The sleep value you specify for WaitNextEvent() will tell the OS to sleep
>
your app for that many ticks or until there is an event in the queue for
>
it. (That is, your app will be awoken to receive any events directed to
>
it.) You can give more time to other tasks by making the sleep value a
>
larger number, such as 60.
>
>
If you are concerned your app might not respond to the incoming packets
>
fast enough, you can have your notifier awaken your app. I don't recall the
>
routine to do this, but it should be obvious from Processes.h or the docs
>
on the Process Manager. (If you cannot find it, drop me a note and I'll
>
look it up.)
Earlier I got the idea that you could post a null-event from the
notifier, however, I do not know if it is legal to do so, and I
definately do not know if it's legal to put any identification-data in
the event record (such as the message could contain a connection ID).
-I'd get someone from Apple to confirm that this will be OK to do, before
doing it.
It may work well on your local computer, but could conflict with other
software.
I've also been thinking about posting an invalid charactercode, such as
$ff00, (keydown seems to be OK to post), still, you should check with
someone who knows if this is OK to do.
Beware: This may be a bad idea if running Mac OS 9.x or below.
The reason is that your app may use only time on handling network stuff,
blocking the UI.
The user would then think of your app as locking up, being slow or sluggish.
Love,
Jens
--
Jens Bauer, Faster Software.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.