Angelixus
Angelixus

Reputation: 260

pthread_create() invokes the function the thread points to?

As the title says, when pthread_create() is invoked, the created thread executes automatically the function it points to or after the creation of the thread you must write a piece of code that invokes the given function?

Upvotes: 0

Views: 38

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33719

If successful, pthread_create has arranged that the thread start routine will eventually run. There is no separate start function you need to call, unlike in Java or Python. Exactly when the thread start routine begins execution is of course unspecified: this can happen before or after pthread_create returns, and vary from one pthread_create call to the next.

For some related discussion, see the Rationale under pthread_create in POSIX.

Upvotes: 4

Related Questions