xref: /freebsd/share/man/man3/pthread_cancel.3 (revision b2c76c41be32f904179efed29c0ca04d53f3996c)
17285bccfSAlfred Perlstein.Dd January 17, 1999
27285bccfSAlfred Perlstein.Dt PTHREAD_CANCEL 3
37285bccfSAlfred Perlstein.Os
47285bccfSAlfred Perlstein.Sh NAME
57285bccfSAlfred Perlstein.Nm pthread_cancel
67285bccfSAlfred Perlstein.Nd cancel execution of a thread
7d8a78688SAlexey Zelkin.Sh LIBRARY
8ec7452f1SRuslan Ermilov.Lb libpthread
97285bccfSAlfred Perlstein.Sh SYNOPSIS
1032eef9aeSRuslan Ermilov.In pthread.h
117285bccfSAlfred Perlstein.Ft int
127285bccfSAlfred Perlstein.Fn pthread_cancel "pthread_t thread"
137285bccfSAlfred Perlstein.Sh DESCRIPTION
147285bccfSAlfred PerlsteinThe
157285bccfSAlfred Perlstein.Fn pthread_cancel
167285bccfSAlfred Perlsteinfunction requests that
177285bccfSAlfred Perlstein.Fa thread
18c6ff3a1bSSheldon Hearnbe canceled.
19c6ff3a1bSSheldon HearnThe target thread's cancelability state and type determines
20c6ff3a1bSSheldon Hearnwhen the cancellation takes effect.
21c6ff3a1bSSheldon HearnWhen the cancellation is acted on,
227285bccfSAlfred Perlsteinthe cancellation cleanup handlers for
237285bccfSAlfred Perlstein.Fa thread
24c6ff3a1bSSheldon Hearnare called.
25c6ff3a1bSSheldon HearnWhen the last cancellation cleanup handler returns,
267285bccfSAlfred Perlsteinthe thread-specific data destructor functions will be called for
277285bccfSAlfred Perlstein.Fa thread .
287285bccfSAlfred PerlsteinWhen the last destructor function returns,
297285bccfSAlfred Perlstein.Fa thread
307285bccfSAlfred Perlsteinwill be terminated.
317285bccfSAlfred Perlstein.Pp
327285bccfSAlfred PerlsteinThe cancellation processing in the target thread runs asynchronously with
337285bccfSAlfred Perlsteinrespect to the calling thread returning from
347285bccfSAlfred Perlstein.Fn pthread_cancel .
357285bccfSAlfred Perlstein.Pp
367285bccfSAlfred PerlsteinA status of
377285bccfSAlfred Perlstein.Dv PTHREAD_CANCELED
38c6ff3a1bSSheldon Hearnis made available to any threads joining with the target.
39c6ff3a1bSSheldon HearnThe symbolic
407285bccfSAlfred Perlsteinconstant
417285bccfSAlfred Perlstein.Dv PTHREAD_CANCELED
427285bccfSAlfred Perlsteinexpands to a constant expression of type
437285bccfSAlfred Perlstein.Ft "(void *)" ,
447285bccfSAlfred Perlsteinwhose value matches no pointer to an object in memory nor the value
457285bccfSAlfred Perlstein.Dv NULL .
467285bccfSAlfred Perlstein.Sh RETURN VALUES
477285bccfSAlfred PerlsteinIf successful, the
487285bccfSAlfred Perlstein.Fn pthread_cancel
49c6ff3a1bSSheldon Hearnfunctions will return zero.
50c6ff3a1bSSheldon HearnOtherwise an error number will be returned to
517285bccfSAlfred Perlsteinindicate the error.
527285bccfSAlfred Perlstein.Sh ERRORS
536f673fd1SPhilippe CharnierThe
547285bccfSAlfred Perlstein.Fn pthread_cancel
556f673fd1SPhilippe Charnierfunction will 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
706f673fd1SPhilippe CharnierThe
717285bccfSAlfred Perlstein.Fn pthread_cancel
726f673fd1SPhilippe Charnierfunction conforms to
73096841ecSRuslan Ermilov.St -p1003.1-96 .
747285bccfSAlfred Perlstein.Sh AUTHORS
75a1601503SHiten PandyaThis manual page was written by
76*a63d6c94SBaptiste Daroussin.An David Leonard Aq Mt d@openbsd.org
77ded8c91aSAlexey Zelkinfor the
78ded8c91aSAlexey Zelkin.Ox
79ded8c91aSAlexey Zelkinimplementation of
80ded8c91aSAlexey Zelkin.Fn pthread_cancel .
81