Hello All,

Since I was looking for something slightly different than Rob had
provided, I managed to make use of his example (TY Rob) and turn it
around into something more 'famliliar'.

The attached 2 files:
ThreadSafe.pm
Threadsafe_1.pl

The module is built around the idea that there *had* to be a way to get
messages from the windows thread (main aka tid == 0 ) to the child
threads.

I renamed things a bit to not confuse anyone with what I was calling.

Basic example:
My $win = #blah we  all know this.

ThreadSafe::Port($win); # locks this window in as the 'Port of call'

#in the child threads/or pipeline threads...
ThreadSafe::Anchor(MESSAGE[,DELETE=0]) 
# this sets up the base module to hook your message 
# and then pass it back to your thread.
ThreadSafe::Dialog(CODEREF); 
# -or-
ThreadSafe::DoEvents(CODEREF);
#@ end of use for MESSAGE
ThreadSafe::Anchor(MESSAGE, DELETE=1);

Those are the basics, and it is **NOT** finished as of yet as I it is
entirely dependant on the window. When the window gets TERMINATE order,
kaboom, lockage... (this example disables the [x] close button, so just
ctrl-c or stop the debugger..)


Its Friday evening, and I'm going home from work!

Jason P

Attachment: threadsafe_1.pl
Description: threadsafe_1.pl

Attachment: ThreadSafe.pm
Description: ThreadSafe.pm

Reply via email to