xref: /freebsd/share/man/man3/pthread_cancel.3 (revision 7285bccf1a9224fadd3b7b81be034cd04f35a820)
17285bccfSAlfred Perlstein.\" $FreeBSD$
27285bccfSAlfred Perlstein.Dd January 17, 1999
37285bccfSAlfred Perlstein.Dt PTHREAD_CANCEL 3
47285bccfSAlfred Perlstein.Os
57285bccfSAlfred Perlstein.Sh NAME
67285bccfSAlfred Perlstein.Nm pthread_cancel
77285bccfSAlfred Perlstein.Nd cancel execution of a thread
87285bccfSAlfred Perlstein.Sh SYNOPSIS
97285bccfSAlfred Perlstein.Fd #include <pthread.h>
107285bccfSAlfred Perlstein.Ft int
117285bccfSAlfred Perlstein.Fn pthread_cancel "pthread_t thread"
127285bccfSAlfred Perlstein.Sh DESCRIPTION
137285bccfSAlfred PerlsteinThe
147285bccfSAlfred Perlstein.Fn pthread_cancel
157285bccfSAlfred Perlsteinfunction requests that
167285bccfSAlfred Perlstein.Fa thread
177285bccfSAlfred Perlsteinbe canceled. The target thread's cancelability state and type determines
187285bccfSAlfred Perlsteinwhen the cancellation takes effect. When the cancellation is acted on,
197285bccfSAlfred Perlsteinthe cancellation cleanup handlers for
207285bccfSAlfred Perlstein.Fa thread
217285bccfSAlfred Perlsteinare called. When the last cancellation cleanup handler returns,
227285bccfSAlfred Perlsteinthe thread-specific data destructor functions will be called for
237285bccfSAlfred Perlstein.Fa thread .
247285bccfSAlfred PerlsteinWhen the last destructor function returns,
257285bccfSAlfred Perlstein.Fa thread
267285bccfSAlfred Perlsteinwill be terminated.
277285bccfSAlfred Perlstein.Pp
287285bccfSAlfred PerlsteinThe cancellation processing in the target thread runs asynchronously with
297285bccfSAlfred Perlsteinrespect to the calling thread returning from
307285bccfSAlfred Perlstein.Fn pthread_cancel .
317285bccfSAlfred Perlstein.Pp
327285bccfSAlfred PerlsteinA status of
337285bccfSAlfred Perlstein.Dv PTHREAD_CANCELED
347285bccfSAlfred Perlsteinis made available to any threads joining with the target. The symbolic
357285bccfSAlfred Perlsteinconstant
367285bccfSAlfred Perlstein.Dv PTHREAD_CANCELED
377285bccfSAlfred Perlsteinexpands to a constant expression of type
387285bccfSAlfred Perlstein.Ft "(void *)" ,
397285bccfSAlfred Perlsteinwhose value matches no pointer to an object in memory nor the value
407285bccfSAlfred Perlstein.Dv NULL .
417285bccfSAlfred Perlstein.Sh RETURN VALUES
427285bccfSAlfred PerlsteinIf successful,  the
437285bccfSAlfred Perlstein.Fn pthread_cancel
447285bccfSAlfred Perlsteinfunctions will return zero. Otherwise an error number will be returned to
457285bccfSAlfred Perlsteinindicate the error.
467285bccfSAlfred Perlstein.Sh ERRORS
477285bccfSAlfred Perlstein.Fn pthread_cancel
487285bccfSAlfred Perlsteinwill fail if:
497285bccfSAlfred Perlstein.Bl -tag -width Er
507285bccfSAlfred Perlstein.It Bq Er ESRCH
517285bccfSAlfred PerlsteinNo thread could be found corresponding to that specified by the given
527285bccfSAlfred Perlsteinthread ID.
537285bccfSAlfred Perlstein.El
547285bccfSAlfred Perlstein.Sh SEE ALSO
557285bccfSAlfred Perlstein.Xr pthread_cleanup_pop 3 ,
567285bccfSAlfred Perlstein.Xr pthread_cleanup_push 3 ,
577285bccfSAlfred Perlstein.Xr pthread_exit 3 ,
587285bccfSAlfred Perlstein.Xr pthread_join 3 ,
597285bccfSAlfred Perlstein.Xr pthread_setcancelstate 3 ,
607285bccfSAlfred Perlstein.Xr pthread_setcanceltype 3 ,
617285bccfSAlfred Perlstein.Xr pthread_testcancel 3
627285bccfSAlfred Perlstein.Sh STANDARDS
637285bccfSAlfred Perlstein.Fn pthread_cancel
647285bccfSAlfred Perlsteinconforms to ISO/IEC 9945-1 ANSI/IEEE
657285bccfSAlfred Perlstein.Pq Dq Tn POSIX
667285bccfSAlfred PerlsteinStd 1003.1 Second Edition 1996-07-12.
677285bccfSAlfred Perlstein.Sh AUTHORS
687285bccfSAlfred PerlsteinThis man page was written by
697285bccfSAlfred Perlstein.An David Leonard <d@openbsd.org>
707285bccfSAlfred Perlsteinfor the OpenBSD implementation of pthread_cancel.
71