summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-11-27 01:30:12 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-11-27 01:30:12 +0000
commitb8df2fd35a2b01942561791bb8404ec56bbfacc4 (patch)
treeb7917b5ba5c3091f84749e9b8b147e72d77050d8 /lib
parent615963c2fb7f9f0c0c4a86517c81b11ce7ae6364 (diff)
do it the single-processor way
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/uthread_seterrno.c20
-rw-r--r--lib/libpthread/uthread/uthread_seterrno.c20
2 files changed, 26 insertions, 14 deletions
diff --git a/lib/libc_r/uthread/uthread_seterrno.c b/lib/libc_r/uthread/uthread_seterrno.c
index 41425e5b134..1b008122ca3 100644
--- a/lib/libc_r/uthread/uthread_seterrno.c
+++ b/lib/libc_r/uthread/uthread_seterrno.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_seterrno.c,v 1.3 1999/11/25 07:01:43 d Exp $ */
+/* $OpenBSD: uthread_seterrno.c,v 1.4 1999/11/27 01:30:11 d Exp $ */
/*
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -41,22 +41,28 @@
* normally hidden from the user.
*/
#ifdef errno
-#undef errno;
+#undef errno
#endif
extern int errno;
void
_thread_seterrno(pthread_t thread, int error)
{
- /* Check for the initial thread: */
- if (thread == _thread_initial)
- /* The initial thread always uses the global error variable: */
+
+ /* Don't allow _thread_run to change: */
+ _thread_kern_sig_defer();
+
+ /* Check for the current thread: */
+ if (thread == _thread_run)
+ /* The current thread always uses the global error variable: */
errno = error;
else
/*
- * Threads other than the initial thread always use the error
- * field in the thread structureL
+ * Threads other than the current thread will keep the error
+ * field in the thread structure:
*/
thread->error = error;
+
+ _thread_kern_sig_undefer();
}
#endif
diff --git a/lib/libpthread/uthread/uthread_seterrno.c b/lib/libpthread/uthread/uthread_seterrno.c
index 41425e5b134..1b008122ca3 100644
--- a/lib/libpthread/uthread/uthread_seterrno.c
+++ b/lib/libpthread/uthread/uthread_seterrno.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_seterrno.c,v 1.3 1999/11/25 07:01:43 d Exp $ */
+/* $OpenBSD: uthread_seterrno.c,v 1.4 1999/11/27 01:30:11 d Exp $ */
/*
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -41,22 +41,28 @@
* normally hidden from the user.
*/
#ifdef errno
-#undef errno;
+#undef errno
#endif
extern int errno;
void
_thread_seterrno(pthread_t thread, int error)
{
- /* Check for the initial thread: */
- if (thread == _thread_initial)
- /* The initial thread always uses the global error variable: */
+
+ /* Don't allow _thread_run to change: */
+ _thread_kern_sig_defer();
+
+ /* Check for the current thread: */
+ if (thread == _thread_run)
+ /* The current thread always uses the global error variable: */
errno = error;
else
/*
- * Threads other than the initial thread always use the error
- * field in the thread structureL
+ * Threads other than the current thread will keep the error
+ * field in the thread structure:
*/
thread->error = error;
+
+ _thread_kern_sig_undefer();
}
#endif