pthread_cleanup_push

Pushes a cleanup routine onto the cleanup stack of the calling thread.

Library:LibC
Classification:POSIX
Service:Threads

Syntax

  #include <pthread.h> 
   
  void pthread_cleanup_push (
     void   (*routine)(void *),
     void   *arg);
  

Parameters

routine

(IN) Points to the routine to push onto the cleanup stack.

arg

(IN) Points to the argument to pass to the cleanup routine.

Remarks

The cleanup routine is executed when the calling thread does one of the following:

  • Exits by calling pthread_exit.

  • Responds to a cancellation request.

  • Calls pthread_cleanup_pop with a nonzero value for the execute parameter.

See Also