Write Single Thread program in Posix Thread

Status
Not open for further replies.

Tasneem AbuQutaish

Reputable
Mar 20, 2015
6
0
4,510
i need to write a single thread program using Posix thread, to compare with multi thread program.
so if i want to write a Pthread program running a single(One) thread, do i :
- use "create thread" to create one thread , Or
- dont create any thread and just depend on the main thread program, as was told that the main program has already one thread by default, thanks
 

kanewolf

Titan
Moderator
If you use Pthread, you capture the overhead of spawning a new thread. I am not sure what granularity of timing is required. This should be milliseconds but if you are trying to determine that type of thing it could be important.

The main() program is a single thread. You could use it.
 
Status
Not open for further replies.