1999-11-28 05:38:13 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.Dd January 17, 1999
|
|
|
|
.Dt PTHREAD_CANCEL 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm pthread_cancel
|
|
|
|
.Nd cancel execution of a thread
|
2000-04-22 15:50:29 +00:00
|
|
|
.Sh LIBRARY
|
2004-01-14 21:44:26 +00:00
|
|
|
.Lb libpthread
|
1999-11-28 05:38:13 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In pthread.h
|
1999-11-28 05:38:13 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn pthread_cancel "pthread_t thread"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn pthread_cancel
|
|
|
|
function requests that
|
|
|
|
.Fa thread
|
2000-03-02 09:14:21 +00:00
|
|
|
be canceled.
|
|
|
|
The target thread's cancelability state and type determines
|
|
|
|
when the cancellation takes effect.
|
|
|
|
When the cancellation is acted on,
|
1999-11-28 05:38:13 +00:00
|
|
|
the cancellation cleanup handlers for
|
|
|
|
.Fa thread
|
2000-03-02 09:14:21 +00:00
|
|
|
are called.
|
|
|
|
When the last cancellation cleanup handler returns,
|
1999-11-28 05:38:13 +00:00
|
|
|
the thread-specific data destructor functions will be called for
|
|
|
|
.Fa thread .
|
|
|
|
When the last destructor function returns,
|
|
|
|
.Fa thread
|
|
|
|
will be terminated.
|
|
|
|
.Pp
|
|
|
|
The cancellation processing in the target thread runs asynchronously with
|
|
|
|
respect to the calling thread returning from
|
|
|
|
.Fn pthread_cancel .
|
|
|
|
.Pp
|
|
|
|
A status of
|
|
|
|
.Dv PTHREAD_CANCELED
|
2000-03-02 09:14:21 +00:00
|
|
|
is made available to any threads joining with the target.
|
|
|
|
The symbolic
|
1999-11-28 05:38:13 +00:00
|
|
|
constant
|
|
|
|
.Dv PTHREAD_CANCELED
|
|
|
|
expands to a constant expression of type
|
|
|
|
.Ft "(void *)" ,
|
|
|
|
whose value matches no pointer to an object in memory nor the value
|
|
|
|
.Dv NULL .
|
|
|
|
.Sh RETURN VALUES
|
2004-07-03 18:29:24 +00:00
|
|
|
If successful, the
|
1999-11-28 05:38:13 +00:00
|
|
|
.Fn pthread_cancel
|
2000-03-02 09:14:21 +00:00
|
|
|
functions will return zero.
|
|
|
|
Otherwise an error number will be returned to
|
1999-11-28 05:38:13 +00:00
|
|
|
indicate the error.
|
|
|
|
.Sh ERRORS
|
2003-02-06 11:10:32 +00:00
|
|
|
The
|
1999-11-28 05:38:13 +00:00
|
|
|
.Fn pthread_cancel
|
2003-02-06 11:10:32 +00:00
|
|
|
function will fail if:
|
1999-11-28 05:38:13 +00:00
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er ESRCH
|
|
|
|
No thread could be found corresponding to that specified by the given
|
|
|
|
thread ID.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr pthread_cleanup_pop 3 ,
|
|
|
|
.Xr pthread_cleanup_push 3 ,
|
|
|
|
.Xr pthread_exit 3 ,
|
|
|
|
.Xr pthread_join 3 ,
|
|
|
|
.Xr pthread_setcancelstate 3 ,
|
|
|
|
.Xr pthread_setcanceltype 3 ,
|
|
|
|
.Xr pthread_testcancel 3
|
|
|
|
.Sh STANDARDS
|
2003-02-06 11:10:32 +00:00
|
|
|
The
|
1999-11-28 05:38:13 +00:00
|
|
|
.Fn pthread_cancel
|
2003-02-06 11:10:32 +00:00
|
|
|
function conforms to
|
2001-02-26 15:16:43 +00:00
|
|
|
.St -p1003.1-96 .
|
1999-11-28 05:38:13 +00:00
|
|
|
.Sh AUTHORS
|
2005-06-30 13:18:15 +00:00
|
|
|
This manual page was written by
|
1999-12-17 14:48:00 +00:00
|
|
|
.An David Leonard Aq d@openbsd.org
|
|
|
|
for the
|
|
|
|
.Ox
|
|
|
|
implementation of
|
|
|
|
.Fn pthread_cancel .
|