开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜