Prev: Whole program optimization and debug symbols
Next: Static linking to MFC/CRT and Standard C++ libraries
From: Jack on 10 Apr 2010 09:26 >>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 11 Apr 2010 21:17 "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 12 Apr 2010 06:55 Thanks tim, I pick it up now Jack
First
|
Prev
|
Pages: 1 2 3 Prev: Whole program optimization and debug symbols Next: Static linking to MFC/CRT and Standard C++ libraries |