thread join question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eps

    #1

    thread join question



    I understand that if I want to wait for a thread to stop then I can use
    the join menthod.

    If I have more than one thread, and I want to wait until they have all
    stopped, what is the best way of doing this ?.



    Thread1.Join();
    Thread2.Join();
    Thread3.Join();
    Thread4.Join();

    If I do the above are there any performance issues depending on whether
    certain threads take longer than others ?.

    Any help appreciated.

    --
    Eps
  • Marc Vangrieken

    #2
    Re: thread join question

    Hi,

    Take a look at this post: http://www.thescripts.com/forum/thread504107.html

    There's no problem with Joining all threads sequentually because
    you're waiting for all of them.. Using WaitAll() with waithandles
    would give you exactly the same performance (afaik).

    Kind regards,

    Marc
    http:\\vangriek en.wordpress.co m

    On 30 dec, 17:18, Eps <e...@mailinato r.comwrote:
    I understand that if I want to wait for a thread to stop then I can use
    the join menthod.
    >
    If I have more than one thread, and I want to wait until they have all
    stopped, what is the best way of doing this ?.
    >
    Thread1.Join();
    Thread2.Join();
    Thread3.Join();
    Thread4.Join();
    >
    If I do the above are there any performance issues depending on whether
    certain threads take longer than others ?.
    >
    Any help appreciated.
    >
    --
    Eps

    Comment

    Working...