List Info

Thread: thread->join method delays signal reception




thread->join method delays signal reception
user name
2006-06-28 13:16:02
You could try having the main thread wait on a shared
variable prior to attempting the join.  The easiest way to
do this with using Thread::Queue.  Start with:
<code>
    use threads;
    use Thread::Queue;

    my $DONE = Thread::Queue->new();

</code>
Have the thread code end by putting its TID onto the
<i>done</i> queue:
<code>
    $DONE->enqueue(threads->tid());
    return (...);

</code>
In the main code, wait for the thread to finish before
attempting a <i>join</i>:
<code>
    my $tid = $DONE->dequeue();
    threads->object($tid)->join();

</code>


To write a respons, access
http://ww
w.cpanforum.com/response_form/2549

To see the full thread, access
http://www.cpan
forum.com/threads/2548

--
You are getting this messages from www.cpanforum.com
To change your subscription information visit http://www.cpanforum.
com/mypan/

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )