[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotification and NSRunLoop

From: Chris B. Vetter
Subject: Re: NSNotification and NSRunLoop
Date: Wed, 29 Oct 2003 10:44:27 -0800

On Wed, 29 Oct 2003 18:23:12 +0000
Richard Frith-Macdonald <address@hidden> wrote:
> Do you have any example code I could try out?  I've certainly used
> that sort of code successfully in the past ... but some particular set
> of circumstances might be triggering a bug of some kind.

I may still have a copy of that particular code at home, I'll check. But
I don't think it is/was a bug in GNUstep, more likely I set up NSRunLoop
in a wrong way.

> One thing I can think of is that notifications are actually only 
> received by the default run loop of the main thread (I don't know if
> this is Apple behavior too) so running another loop will not enable
> notifications to be received. I *think* this is correct ... but
> perhaps it's a bug to be fixed and the notification
> reception should be automatically added to all run loops.

Hmm, if I remember correctly, I simply used an instance of +currentLoop,
then entered the while() and tried to run NSRunLoop for a couple of
seconds (since I wanted to create something like a "timeout").

The timeout never occurred, so I added another "rule" to leave the
while() and voila, I received all the notifications at once, instead of
during running the loop.

As I said, adding the while() via NSTimer, and then runUntilDate did
exactly what I wanted, so I didn't look into it any further (figuring
that I made a bad assumption as to how NSRunLoop actually works).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]