in reply to waking from select, or IO::Pipe in same process?

Yes. select will wake up on pipes. (select's emulation only works on socket in Windows, though.) I wouldn't use select directly, I'd use via IO::Select.

Pipes are usually used between processes, but they don't have to be. Just make sure you don't fill up the pipe, as that would block the only process that can empty it. I wouldn't bother with IO::Pipe. It doesn't add anything good over pipe.

If you're using threads, you should look at Thread::Queue.

Replies are listed 'Best First'.
Re^2: waking from select, or IO::Pipe in same process?
by checker (Novice) on Jul 15, 2011 at 03:45 UTC

    Hmm, it looks like IO::Socket::INET's accept already does something with signals. If I install an empty signal handler at the top level, then accept() returns undef cleanly. The perlipc docs show an example of checking for EINTR in this case. I haven't tested IO::Select yet, but I'd assume it behaves the same.

    Chris

      IO::Select is just a thin wrapper around select. accept and select are just thin wrapper around the system calls with the same name. They should return error EINTR when interrupted by a signal (which will only happen if you have a signal handler defined).

        Ah, somehow I missed that in my reading about how to do this. If that's the case, I don't need the pipe at all, which is nice.

        Thanks!
        Chris