in reply to is_joinable question

main did not wait because is_joinable returned false, so you didn't join

if you want to wait for $thrHandle, simply join, join blocks, join waits until the thread over, until it is_joinable

Study this example Re^2: Thread parallel execution (joinable)

Replies are listed 'Best First'.
Re^2: is_joinable question
by anaconda_wly (Scribe) on Jun 04, 2013 at 06:03 UTC

    example you give works, but I didn't understand difference between threads->list( threads::joinable ) and is_joinable yet

    while( threads->list ) { for my $joinable ( threads->list( threads::joinable ) ) { $joinable->join; } }

      I can ask my kids "is mom home yet?" and get a yes or no answer. I can also ask them to wait outside until their mom gets back. The first is like is_joinable, the second is like join. One gets a yes or no answer, the other blocks until it is done.

      Update: Ignore me. Didn't read the question completely.

      --MidLifeXis

      example you give works, but I didn't understand difference between threads->list( threads::joinable ) and is_joinable yet

      Ok, and then what happened? Do you have a question? What do you understand?

      Do you understand the difference between a while loop and an if statement?