in reply to Async IO / signals

IIRC, read(2) isn't safe to be called in a signal handler, but I'd have to look at one of Richard Stevens' books to be sure.

Can you just block signals or set a flag while you're doing the sysread? Or could you implement this as two processes communicating through shared memory?

Replies are listed 'Best First'.
Re: Re: Async IO / signals
by Anonymous Monk on Apr 20, 2004 at 10:15 UTC
    read(2) is safe to call in a signal handler, I've checked W. Richard Stevens' Advanced Programming in the Unix Environment for confirmation. Of course, you would need the buffer to be allocated beforehand to use read in a perl signal handler to avoid a malloc.
      Agreed. I just verified that in my copy of APUE.