0

Hello,

Im using threads in a recent project. I would like to know whats the difference between:
pthread_kill() and pthread_cancel()

What are the effects of each one?

Thank you!

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by Vijikumar
0

Hello,

Im using threads in a recent project. I would like to know whats the difference between:
pthread_kill() and pthread_cancel()

What are the effects of each one?

Thank you!

If your using Linux/Unix try open a terminal and type
man pthread_kill
man pthread_cancel
and it will retrieve all the info you need.

0

pthread_cancel() : This API used to terminated the another thread, based on cancel ability state the cleanup handlers are called if any handlers are registered before invoking the thread destructor.

pthread_kill() : This API used just like "kill()" API, it raises a signal to thread. It is possible that some times it affects the entire process like when passed SIGKILL to pthread_kill will terminate the entire process.

pthread_kill() can also be used for the activities other than just terminating the thread by passing different signals.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.