Re: Threading



On Sun, 6 Aug 2006 21:38:16 +0200
"Jens Luedicke" <jens luedicke gmail com> wrote:

Heya...

How do I wait for a thread to join without blocking the
GUI?

like:

1) show dialog

2) start resource heavy stuff in thread

3) wait for thread to finish

4) destroy dialog

the problem is: $thread->join; blocks. my thread is still doing
it's stuff but my GUI is (b)locked.

another idea is to use a shared boolean variable that is set
to true/false to indicate the threads status.

any hints?

The shared boolean is the way I would do it. Have the thread set
the boolean just before it returns (or finishes it's code block), then
in the main thread, use a timer to test repeatedly for the boolean, then
if boolean is true, thread->join.  That won't block.

zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]