APM: Perl IPC and select()

Brian Michalk michalk at awpi.com
Wed Nov 20 09:10:56 CST 2002


When doing shared memory in Perl, one does not get an actual variable to a
memory location because of Perl's garbage collection.  Rather, one must call
the msgrcv command (see perldoc perlipc) to see if a message has arrived.
Now, being a lazy (and therefore excellent) programmer, I see something with
rcv in it, and I want to place the handle in a select statement.  However,
the handle is not a file handle, it's a shared memory ID.

I've got all of my classes interacting via handles (sockets and pipes), but
I have a radar with an extremely high sample rate, and going through file IO
is taking too much overhead.

So, a select() would be nice.  However, catching a signal is certainly
doable and easy, it just kind of is not as pretty because now I have two
signalling mechanisms.  It's going to break my pretty symmetry.

Another concern is that using signals in my modules is not going to be very
robust (something about non-reentrant libraries).  I suppose I could catch
the signal, then place something on a file handle causing a select() to
return a particular filehandle that would indicate valid data on a certain
shared memory segment.

Thoughts?




More information about the Austin mailing list