xref: /freebsd/share/man/man3/pthread_cancel.3 (revision 096841eceb6f1e33621f6688cd52239f87d99c31)
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
8d8a78688SAlexey Zelkin.Sh LIBRARY
9d8a78688SAlexey Zelkin.Lb libc_r
107285bccfSAlfred Perlstein.Sh SYNOPSIS
117285bccfSAlfred Perlstein.Fd #include <pthread.h>
127285bccfSAlfred Perlstein.Ft int
137285bccfSAlfred Perlstein.Fn pthread_cancel "pthread_t thread"
147285bccfSAlfred Perlstein.Sh DESCRIPTION
157285bccfSAlfred PerlsteinThe
167285bccfSAlfred Perlstein.Fn pthread_cancel
177285bccfSAlfred Perlsteinfunction requests that
187285bccfSAlfred Perlstein.Fa thread
19c6ff3a1bSSheldon Hearnbe canceled.
20c6ff3a1bSSheldon HearnThe target thread's cancelability state and type determines
21c6ff3a1bSSheldon Hearnwhen the cancellation takes effect.
22c6ff3a1bSSheldon HearnWhen the cancellation is acted on,
237285bccfSAlfred Perlsteinthe cancellation cleanup handlers for
247285bccfSAlfred Perlstein.Fa thread
25c6ff3a1bSSheldon Hearnare called.
26c6ff3a1bSSheldon HearnWhen the last cancellation cleanup handler returns,
277285bccfSAlfred Perlsteinthe thread-specific data destructor functions will be called for
287285bccfSAlfred Perlstein.Fa thread .
297285bccfSAlfred PerlsteinWhen the last destructor function returns,
307285bccfSAlfred Perlstein.Fa thread
317285bccfSAlfred Perlsteinwill be terminated.
327285bccfSAlfred Perlstein.Pp
337285bccfSAlfred PerlsteinThe cancellation processing in the target thread runs asynchronously with
347285bccfSAlfred Perlsteinrespect to the calling thread returning from
357285bccfSAlfred Perlstein.Fn pthread_cancel .
367285bccfSAlfred Perlstein.Pp
377285bccfSAlfred PerlsteinA status of
387285bccfSAlfred Perlstein.Dv PTHREAD_CANCELED
39c6ff3a1bSSheldon Hearnis made available to any threads joining with the target.
40c6ff3a1bSSheldon HearnThe symbolic
417285bccfSAlfred Perlsteinconstant
427285bccfSAlfred Perlstein.Dv PTHREAD_CANCELED
437285bccfSAlfred Perlsteinexpands to a constant expression of type
447285bccfSAlfred Perlstein.Ft "(void *)" ,
457285bccfSAlfred Perlsteinwhose value matches no pointer to an object in memory nor the value
467285bccfSAlfred Perlstein.Dv NULL .
477285bccfSAlfred Perlstein.Sh RETURN VALUES
487285bccfSAlfred PerlsteinIf successful,  the
497285bccfSAlfred Perlstein.Fn pthread_cancel
50c6ff3a1bSSheldon Hearnfunctions will return zero.
51c6ff3a1bSSheldon HearnOtherwise an error number will be returned to
527285bccfSAlfred Perlsteinindicate the error.
537285bccfSAlfred Perlstein.Sh ERRORS
547285bccfSAlfred Perlstein.Fn pthread_cancel
557285bccfSAlfred Perlsteinwill fail if:
567285bccfSAlfred Perlstein.Bl -tag -width Er
577285bccfSAlfred Perlstein.It Bq Er ESRCH
587285bccfSAlfred PerlsteinNo thread could be found corresponding to that specified by the given
597285bccfSAlfred Perlsteinthread ID.
607285bccfSAlfred Perlstein.El
617285bccfSAlfred Perlstein.Sh SEE ALSO
627285bccfSAlfred Perlstein.Xr pthread_cleanup_pop 3 ,
637285bccfSAlfred Perlstein.Xr pthread_cleanup_push 3 ,
647285bccfSAlfred Perlstein.Xr pthread_exit 3 ,
657285bccfSAlfred Perlstein.Xr pthread_join 3 ,
667285bccfSAlfred Perlstein.Xr pthread_setcancelstate 3 ,
677285bccfSAlfred Perlstein.Xr pthread_setcanceltype 3 ,
687285bccfSAlfred Perlstein.Xr pthread_testcancel 3
697285bccfSAlfred Perlstein.Sh STANDARDS
707285bccfSAlfred Perlstein.Fn pthread_cancel
71096841ecSRuslan Ermilovconforms to
72096841ecSRuslan Ermilov.St -p1003.1-96 .
737285bccfSAlfred Perlstein.Sh AUTHORS
747285bccfSAlfred PerlsteinThis man page was written by
75ded8c91aSAlexey Zelkin.An David Leonard Aq d@openbsd.org
76ded8c91aSAlexey Zelkinfor the
77ded8c91aSAlexey Zelkin.Ox
78ded8c91aSAlexey Zelkinimplementation of
79ded8c91aSAlexey Zelkin.Fn pthread_cancel .
80