in reply to Threaded perl (re: debian bug #203579)

As others have pointed out, the core of the problem is turning the lock object into a simple scalar. However, that still shouldn't cause perl to coredump. Turns out it was a bug in cond_signal(), reproducable as follows:
use threads; use threads::shared; my $rw = 0; cond_signal $rw;
I've now fixed this in bleedperl.

As regards to the OP's code, I'd recommend avoiding low-level stuff like cond_wait()/cond_signal() where possible; they are very hard to get right and avoid deadlock. For example I suspect from a brief look at the code that there are are multiple race conditions. Instead, use something like Thread::Queue which takes away most of the pain about passing streams of commands or data between threads.

Dave.