diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2004-01-01 08:19:34 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2004-01-01 08:19:34 +0000 |
commit | 630d54740ac81f7aa979b32790aeeaac07055c46 (patch) | |
tree | dd7ce4272969cbedcb1db6c180059eee3e604f2e /lib/libpthread/uthread | |
parent | 2c8cae96fba5cba8184ba9a45b45bef097c939bf (diff) |
more cancellation points.
ok marc@
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_poll.c | 8 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_readv.c | 9 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_select.c | 5 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_writev.c | 8 |
4 files changed, 25 insertions, 5 deletions
diff --git a/lib/libpthread/uthread/uthread_poll.c b/lib/libpthread/uthread/uthread_poll.c index 239b3f62da6..a2b42219d41 100644 --- a/lib/libpthread/uthread/uthread_poll.c +++ b/lib/libpthread/uthread/uthread_poll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_poll.c,v 1.8 2003/12/10 23:10:08 millert Exp $ */ +/* $OpenBSD: uthread_poll.c,v 1.9 2004/01/01 08:19:33 brad Exp $ */ /* * Copyright (c) 1999 Daniel Eischen <eischen@vigrid.com> * All rights reserved. @@ -53,6 +53,9 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout) int i, ret = 0; struct pthread_poll_data data; + /* This is a cancellation point: */ + _thread_enter_cancellation_point(); + if (numfds > _thread_dtablesize) { numfds = _thread_dtablesize; } @@ -96,6 +99,9 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout) } } + /* No longer in a cancellation point: */ + _thread_leave_cancellation_point(); + return (ret); } #endif diff --git a/lib/libpthread/uthread/uthread_readv.c b/lib/libpthread/uthread/uthread_readv.c index 05661166b4c..80a91e29637 100644 --- a/lib/libpthread/uthread/uthread_readv.c +++ b/lib/libpthread/uthread/uthread_readv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_readv.c,v 1.5 2001/08/21 19:24:53 fgsch Exp $ */ +/* $OpenBSD: uthread_readv.c,v 1.6 2004/01/01 08:19:33 brad Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -49,6 +49,9 @@ readv(int fd, const struct iovec * iov, int iovcnt) ssize_t ret; int type; + /* This is a cancellation point: */ + _thread_enter_cancellation_point(); + /* Lock the file descriptor for read: */ if ((ret = _FD_LOCK(fd, FD_READ, NULL)) == 0) { /* Get the read/write mode type: */ @@ -90,6 +93,10 @@ readv(int fd, const struct iovec * iov, int iovcnt) } _FD_UNLOCK(fd, FD_READ); } + + /* No longer in a cancellation point: */ + _thread_leave_cancellation_point(); + return (ret); } #endif diff --git a/lib/libpthread/uthread/uthread_select.c b/lib/libpthread/uthread/uthread_select.c index b3a227b474e..112e07eb233 100644 --- a/lib/libpthread/uthread/uthread_select.c +++ b/lib/libpthread/uthread/uthread_select.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_select.c,v 1.9 2003/11/03 20:27:48 marc Exp $ */ +/* $OpenBSD: uthread_select.c,v 1.10 2004/01/01 08:19:33 brad Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -61,7 +61,7 @@ select(int numfds, fd_set * readfds, fd_set * writefds, struct pthread_poll_data data; fd_mask mask, rmask, wmask, emask; - /* this is a cancellation point per IEEE Std 1003.1-2001 */ + /* This is a cancellation point: */ _thread_enter_cancellation_point(); if (numfds > _thread_dtablesize) { @@ -221,6 +221,7 @@ select(int numfds, fd_set * readfds, fd_set * writefds, } done: + /* No longer in a cancellation point: */ _thread_leave_cancellation_point(); return (ret); diff --git a/lib/libpthread/uthread/uthread_writev.c b/lib/libpthread/uthread/uthread_writev.c index 9c2e6ecd292..fd1c553ef23 100644 --- a/lib/libpthread/uthread/uthread_writev.c +++ b/lib/libpthread/uthread/uthread_writev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_writev.c,v 1.7 2003/12/22 21:28:47 brad Exp $ */ +/* $OpenBSD: uthread_writev.c,v 1.8 2004/01/01 08:19:33 brad Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -58,6 +58,9 @@ writev(int fd, const struct iovec * iov, int iovcnt) struct iovec liov[20]; struct iovec *p_iov = liov; + /* This is a cancellation point: */ + _thread_enter_cancellation_point(); + /* Check if the array size exceeds to compiled in size: */ if (iovcnt > (int) (sizeof(liov) / sizeof(struct iovec))) { /* Allocate memory for the local array: */ @@ -215,6 +218,9 @@ writev(int fd, const struct iovec * iov, int iovcnt) if (p_iov != liov) free(p_iov); + /* No longer in a cancellation point: */ + _thread_leave_cancellation_point(); + return (ret); } #endif |