Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpthread Manually inline pthread__testcancel in these ...
details: https://anonhg.NetBSD.org/src/rev/27d0c489e201
branches: trunk
changeset: 555569:27d0c489e201
user: nathanw <nathanw%NetBSD.org@localhost>
date: Fri Nov 21 23:03:13 2003 +0000
description:
Manually inline pthread__testcancel in these routines; two function
calls' worth of overhead per cancellable syscall is overkill.
diffstat:
lib/libpthread/pthread_cancelstub.c | 85 +++++++++++++++++++-----------------
1 files changed, 45 insertions(+), 40 deletions(-)
diffs (262 lines):
diff -r 4caf174d7dd2 -r 27d0c489e201 lib/libpthread/pthread_cancelstub.c
--- a/lib/libpthread/pthread_cancelstub.c Fri Nov 21 22:57:14 2003 +0000
+++ b/lib/libpthread/pthread_cancelstub.c Fri Nov 21 23:03:13 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cancelstub.c,v 1.6 2003/11/18 00:56:57 thorpej Exp $ */
+/* $NetBSD: pthread_cancelstub.c,v 1.7 2003/11/21 23:03:13 nathanw Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.6 2003/11/18 00:56:57 thorpej Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.7 2003/11/21 23:03:13 nathanw Exp $");
/*
* This is necessary because the fsync_range() name is always weak (it is
@@ -90,6 +90,11 @@
ssize_t _sys_write(int, const void *, size_t);
ssize_t _sys_writev(int, const struct iovec *, int);
+#define TESTCANCEL(id) do { \
+ if (__predict_false((id)->pt_cancel)) \
+ pthread_exit(PTHREAD_CANCELED); \
+ } while (0)
+
int
accept(int s, struct sockaddr *addr, socklen_t *addrlen)
@@ -98,9 +103,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_accept(s, addr, addrlen);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -112,9 +117,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_close(d);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -126,9 +131,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_connect(s, addr, namelen);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -141,11 +146,11 @@
va_list ap;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
va_start(ap, cmd);
retval = _sys_fcntl(fd, cmd, va_arg(ap, void *));
va_end(ap);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -157,9 +162,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_fsync(d);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -171,9 +176,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_fsync_range(d, f, s, e);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -185,9 +190,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_msgrcv(msgid, msgp, msgsz, msgtyp, msgflg);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -199,9 +204,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_msgsnd(msgid, msgp, msgsz, msgflg);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -213,9 +218,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys___msync13(addr, len, flags);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -228,11 +233,11 @@
va_list ap;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
va_start(ap, flags);
retval = _sys_open(path, flags, va_arg(ap, mode_t));
va_end(ap);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -244,9 +249,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_poll(fds, nfds, timeout);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -258,9 +263,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_pread(d, buf, nbytes, offset);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -272,9 +277,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_pwrite(d, buf, nbytes, offset);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -286,9 +291,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_read(d, buf, nbytes);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -300,9 +305,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_readv(d, iov, iovcnt);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -315,9 +320,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_select(nfds, readfds, writefds, exceptfds, timeout);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -329,9 +334,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_wait4(wpid, status, options, rusage);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -343,9 +348,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_write(d, buf, nbytes);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
@@ -357,9 +362,9 @@
pthread_t self;
self = pthread__self();
- pthread__testcancel(self);
+ TESTCANCEL(self);
retval = _sys_writev(d, iov, iovcnt);
- pthread__testcancel(self);
+ TESTCANCEL(self);
return retval;
}
Home |
Main Index |
Thread Index |
Old Index