summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_sendto.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_sendto.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_sendto.c')
-rw-r--r--lib/libpthread/uthread/uthread_sendto.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_sendto.c b/lib/libpthread/uthread/uthread_sendto.c
index 062d11e77ac..c2ad04b0e2a 100644
--- a/lib/libpthread/uthread/uthread_sendto.c
+++ b/lib/libpthread/uthread/uthread_sendto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_sendto.c,v 1.5 2001/08/21 19:24:53 fgsch Exp $ */
+/* $OpenBSD: uthread_sendto.c,v 1.6 2003/12/23 19:31:05 brad Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -46,6 +46,9 @@ sendto(int fd, const void *msg, size_t len, int flags, const struct sockaddr * t
struct pthread *curthread = _get_curthread();
int ret;
+ /* This is a cancellation point: */
+ _thread_enter_cancellation_point();
+
if ((ret = _FD_LOCK(fd, FD_WRITE, NULL)) == 0) {
while ((ret = _thread_sys_sendto(fd, msg, len, flags, to, to_len)) < 0) {
if (!(_thread_fd_table[fd]->flags & O_NONBLOCK) && ((errno == EWOULDBLOCK) || (errno == EAGAIN))) {
@@ -69,6 +72,10 @@ sendto(int fd, const void *msg, size_t len, int flags, const struct sockaddr * t
}
_FD_UNLOCK(fd, FD_WRITE);
}
+
+ /* No longer in a cancellation point: */
+ _thread_leave_cancellation_point();
+
return (ret);
}
#endif