Reputation: 749
How do I self-terminate pthread execution?
I have this code
while(1)
{
if(...)
{
terminate
}
work();
}
I have to use pthread_exit();
but what do I give as parameter?
Upvotes: 0
Views: 400
Reputation: 133919
According to the manuals
The
pthread_exit()
function terminates the calling thread and returns a value viaretval
that (if the thread is joinable) is available to another thread in the same process that callspthread_join(3)
.
This is any value you want to provide to the joining thread. If you do not need a return value, you can pass NULL
.
Upvotes: 2