Re: Cocoa & signal handlers
Re: Cocoa & signal handlers
- Subject: Re: Cocoa & signal handlers
- From: Greg Parker <email@hidden>
- Date: Mon, 10 Dec 2001 15:55:07 -0800
On Monday, December 10, 2001, at 02:56 PM, Ingvar Nedrebo wrote:
On Monday, December 10, 2001, at 10:04 , Greg Parker wrote:
You may also be able to use CFRunLoop APIs from CoreFoundation to
wake up the run loop directly. -readInBackgroundAndNotify will
need to do something like this internally, so if this isn't safe
then neither is the pipe.
My understanding from the documentation of readInBackgroundAndNotify
was that it does the read in a separate thread -- on the face
of it it looks fairly safe to do a single system call in a signal
handler, provided of course that the write doesn't block, but
I'm only writing 4 bytes (the signal number).
You may be right, the write() method may be safe even if waking the run
loop from the signal handler is not. -readInBackgroundAndNotify probably
works like CFSocket with a second thread running select(). That thread
does need to wake up the run loop, but it doesn't need to talk to the
run loop during the signal handler.
--
Greg Parker email@hidden Java & Objective C