if I create a thread in my application, is it a 1-thread or 2-thread applications?
I have a stupid question to ask:
If I have an application where 开发者_开发技巧I create one thread, is it a two-thread application or one?
the part of code that is not in the thread what is? is not a thread..
Cheers
Your application is always a thread in main process.
So the other thread is (at least) the second one.
it is 2 threads, the first thread is that which runs 'main' and calls your code to create the 2nd thread...
try constructing a thread and then outputing the thread id (or whatever language you are using toString() or equivalent) and then doing the same thing immediately after you create the new thread. pseudo like:
Main:
Construct Thread to run ThreadProc
Print this thread identifier
Exit
ThreadProc:
Print this thread identifier
Exit
精彩评论