summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_accept.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2003-12-23 19:31:06 +0000
committerBrad Smith <brad@cvs.openbsd.org>2003-12-23 19:31:06 +0000
commitdfba0d060b608e83a1fd3fc0398a3ade9d479e4b (patch)
tree42a4346ed8e9895d2642a758c2ea40f39bf66bb8 /lib/libpthread/uthread/uthread_accept.c
parent59c4a1cc1296ea258ae7b7c86aca3cced0776b24 (diff)
Make accept(), connect(), recvfrom(), recvmsg(), sendmsg(),
and sendto() cancellation points, as required by POSIX.1-2001. From: FreeBSD' libc_r ok marc@
Diffstat (limited to 'lib/libpthread/uthread/uthread_accept.c')
-rw-r--r--lib/libpthread/uthread/uthread_accept.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_accept.c b/lib/libpthread/uthread/uthread_accept.c
index a3f424084fc..eb88a166753 100644
--- a/lib/libpthread/uthread/uthread_accept.c
+++ b/lib/libpthread/uthread/uthread_accept.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_accept.c,v 1.7 2002/11/12 20:12:45 marc Exp $ */
+/* $OpenBSD: uthread_accept.c,v 1.8 2003/12/23 19:31:05 brad Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -47,6 +47,9 @@ accept(int fd, struct sockaddr * name, socklen_t *namelen)
struct pthread *curthread = _get_curthread();
int ret;
+ /* This is a cancellation point: */
+ _thread_enter_cancellation_point();
+
/* Lock the file descriptor: */
if ((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) {
/* Enter a loop to wait for a connection request: */
@@ -101,6 +104,10 @@ accept(int fd, struct sockaddr * name, socklen_t *namelen)
/* Unlock the file descriptor: */
_FD_UNLOCK(fd, FD_RDWR);
}
+
+ /* No longer in a cancellation point: */
+ _thread_leave_cancellation_point();
+
/* Return the socket file descriptor or -1 on error: */
return (ret);
}