[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 09:54:46 -0800 |
On Wed, 29 Oct 2003 06:18:51 +0000
Richard Frith-Macdonald <richard@brainstorm.co.uk> wrote:
> On Wednesday, October 29, 2003, at 01:29 AM, Yen-Ju Chen wrote:
> > Why does it happen ?
> > Do I have to use NSRunLoop in order to receive NSNotification in
> > the middle of while loop ?
> Yes ... events only arrive while a run loop is running ... so you
> need to run the runloop within your while loop.
[...]
I was playing with sockets the other day and ran into a similar problem,
Yen-Ju was having (with respect to NSRunLoop and NSNotification).
Basically I did the same as you suggested (put NSRunLoop inside a loop)
and never received any notifications, until the while() finished. When I
put the while() in a separate method, added it to a timer and fired that
one off, it worked... Weird.
--
Chris