summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_join.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-01-17 23:57:29 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-01-17 23:57:29 +0000
commit5ca1f71120ac2bc81b65a6cef298606b92242903 (patch)
tree82d901bf8097936d39c68cdb89cc598d1e1fccd6 /lib/libpthread/uthread/uthread_join.c
parent209640f64878cc32de9cf45178c9a0e979525bdd (diff)
pthread_cancel() and cancellation points
Diffstat (limited to 'lib/libpthread/uthread/uthread_join.c')
-rw-r--r--lib/libpthread/uthread/uthread_join.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_join.c b/lib/libpthread/uthread/uthread_join.c
index 9602ec52a25..52baee31c33 100644
--- a/lib/libpthread/uthread/uthread_join.c
+++ b/lib/libpthread/uthread/uthread_join.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: uthread_join.c,v 1.2 1999/01/06 05:29:24 d Exp $
+ * $OpenBSD: uthread_join.c,v 1.3 1999/01/17 23:57:27 d Exp $
*/
#include <errno.h>
#ifdef _THREAD_SAFE
@@ -42,15 +42,21 @@ pthread_join(pthread_t pthread, void **thread_return)
int ret = 0;
pthread_t pthread1 = NULL;
+ _thread_enter_cancellation_point();
+
/* Check if the caller has specified an invalid thread: */
- if (pthread == NULL || pthread->magic != PTHREAD_MAGIC)
+ if (pthread == NULL || pthread->magic != PTHREAD_MAGIC) {
/* Invalid thread: */
+ _thread_leave_cancellation_point();
return(EINVAL);
+ }
/* Check if the caller has specified itself: */
- if (pthread == _thread_run)
+ if (pthread == _thread_run) {
/* Avoid a deadlock condition: */
+ _thread_leave_cancellation_point();
return(EDEADLK);
+ }
/*
* Find the thread in the list of active threads or in the
@@ -93,6 +99,8 @@ pthread_join(pthread_t pthread, void **thread_return)
/* Return the thread's return value: */
*thread_return = pthread->ret;
+ _thread_leave_cancellation_point();
+
/* Return the completion status: */
return (ret);
}