From: Jack on

>>Could I ask one further question before I move on...
>>I find out that the thread returns and exits
>>immediately after the run call.
>>Are there any ways to run the thread infinitely
>>without limit?
>
> The thread will run until your function returns, then it exits. If you
> need it to do work, then code the thread so it does work.
> --

Hi Tim,
Where would be the best place to put the join call?
Thanks
Jack



From: Tim Roberts on
"Jack" <jl(a)knight.com> wrote:
>
>>>Could I ask one further question before I move on...
>>>I find out that the thread returns and exits
>>>immediately after the run call.
>>>Are there any ways to run the thread infinitely
>>>without limit?
>>
>> The thread will run until your function returns, then it exits. If you
>> need it to do work, then code the thread so it does work.
>
>Hi Tim,
>Where would be the best place to put the join call?

The "join" concept comes from Linux pthreads. Basically, you do a "join"
whenever you need to know that the thread is finished. In Windows terms,
"join" is exactly like
WaitForSingleObject( hThread, INFINITE );

It simply blocks until the thread exits. So, the spot you wait depends on
when you need to know the thread is done.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Jack on
Thanks tim, I pick it up now
Jack