You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The semantics of pthread_cleanup_push() and pthread_cleanup_pop() is so unusual that it warrants a demo.
Something like this could be used to demonstrate how to use cleanup function that is called no matter how the worker thread goes away:
void*worker(void*)
{
pthread_cleanup_push(cleanup, NULL);
// ... do some work// Make sure the cleanup is always called.pthread_cancel(pthread_self());
pthread_testcancel();
pthread_cleanup_pop(0);
}
The text was updated successfully, but these errors were encountered:
The semantics of
pthread_cleanup_push()
andpthread_cleanup_pop()
is so unusual that it warrants a demo.Something like this could be used to demonstrate how to use cleanup function that is called no matter how the worker thread goes away:
The text was updated successfully, but these errors were encountered: