"Nigel Rantor" <wi...@wiggly.org> wrote: > Hendrik van Rooyen wrote: > > > > If you have any interest, contact me and I will > > send you the source. > > Maybe you could tell people what the point is...
Well its a long story, but you did ask... I am working on an i/o system, running in an ebox - it is basically a 486 with 128 meg running slackware, and its job is to serve as an i/o server, reading inputs and setting relay and other outputs. A nice slow 300 Mhz machine - not fast at all. Now the thread that does the i/o gets commands over a queue from a socket , so they are strings, and they look like this: "A,10101010,00010010" where the "A" means its an I/O command, and the ascii binary is stuff that must be written. The response looks the same, but it has more fields as it reflects both the state of the current inputs and the current outputs. The responses are written to an output queue that is serviced by another thread. Now I did not want to waste any cycles deciding how to unpack the incoming stuff, so I just use split(','). So then I wanted to add a command to change masters, passing an alternate output queue, so that the changeover is confirmed. But a queue is not a string, and you can also not pickle it. So I messed around for a while passing the name of the new queue, and doing exec magic. This worked, but only if the new queue was a global, which was kind of yucky. So then I started thinking - why can't I just pass a simple pointer to the object, and the can was the result. It is not really something that is all that useful - only if you want to pass the reference "as part of a string". It is now working in the ebox too, but it does not look as good - the strings look like negative numbers, but they uncan fine. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list