#include <pthread.h> void pthread_cleanup_push_defer_np(void (*routine)(void *), void *arg); void pthread_cleanup_pop_restore_np(int execute);
Exigences de macros de test de fonctionnalités pour la glibc (consulter feature_test_macros(7)) :
pthread_cleanup_push_defer_np(), pthread_cleanup_pop_defer_np() :
_GNU_SOURCE
Like pthread_cleanup_push(3), pthread_cleanup_push_defer_np() pushes routine onto the thread's stack of cancelation clean-up handlers. In addition, it also saves the thread's current cancelability type, and sets the cancelability type to "deferred" (see pthread_setcanceltype(3)); this ensures that cancelation clean-up will occur even if the thread's cancelability type was "asynchronous" before the call.
Like pthread_cleanup_pop(3), pthread_cleanup_pop_restore_np() pops the top-most clean-up handler from the thread's stack of cancelation clean-up handlers. In addition, it restores the thread's cancelability type to its value at the time of the matching pthread_cleanup_push_defer_np().
L'appelant doit vérifier que les appels à ces fonctions sont appariés à l'intérieur de la même fonction, et au même niveau d'imbriquement lexical. D'autres restrictions s'appliquent, comme expliqué dans pthread_cleanup_push(3).
Cette séquence d'appels :
pthread_cleanup_push_defer_np(routine, arg); pthread_cleanup_pop_restore_np(execute);
est équivalente à (mais en plus court et plus efficace) :
int oldtype;
pthread_cleanup_push(routine, arg); pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); ... pthread_setcanceltype(oldtype, NULL); pthread_cleanup_pop(execute);
Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.
Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à