summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-01-10 23:11:34 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-01-10 23:11:34 +0000
commit2bac709a82004fa9918b2ea5051d59e8e5ed1720 (patch)
tree11557be3eddde6b942652de25c0a5ad061d1368c /lib/libpthread/uthread
parentd672f2f2bf16ac083c980e01c249a1e124672be5 (diff)
export symbol to kernel thread for gdb; ident; fix lock initialisation
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r--lib/libpthread/uthread/uthread_init.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libpthread/uthread/uthread_init.c b/lib/libpthread/uthread/uthread_init.c
index 1202429e51a..ad56b9a670c 100644
--- a/lib/libpthread/uthread/uthread_init.c
+++ b/lib/libpthread/uthread/uthread_init.c
@@ -29,6 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
+ * $OpenBSD: uthread_init.c,v 1.7 1999/01/10 23:11:33 d Exp $
*/
#include <errno.h>
@@ -50,8 +51,9 @@
/* Allocate space for global thread variables here: */
-struct pthread _thread_kern_thread;
-struct pthread * volatile _thread_run = &_thread_kern_thread;
+static struct pthread kern_thread;
+struct pthread * volatile _thread_kern_threadp = &kern_thread;
+struct pthread * volatile _thread_run = &kern_thread;
struct pthread * volatile _thread_single = NULL;
struct pthread * volatile _thread_link_list = NULL;
int _thread_kern_pipe[2] = { -1, -1 };
@@ -187,7 +189,7 @@ _thread_init(void)
/* Make the write pipe non-blocking: */
else if (_thread_sys_fcntl(_thread_kern_pipe[1], F_SETFL, flags | O_NONBLOCK) == -1) {
/* Abort this application: */
- PANIC("Cannot get kernel write pipe flags");
+ PANIC("Cannot make kernel write pipe non-blocking");
}
/* Allocate memory for the thread structure of the initial thread: */
else if ((_thread_initial = (pthread_t) malloc(sizeof(struct pthread))) == NULL) {
@@ -198,9 +200,9 @@ _thread_init(void)
PANIC("Cannot allocate memory for initial thread");
} else {
/* Zero the global kernel thread structure: */
- memset(&_thread_kern_thread, 0, sizeof(struct pthread));
- _thread_kern_thread.magic = PTHREAD_MAGIC;
- pthread_set_name_np(&_thread_kern_thread, "kern");
+ memset(_thread_kern_threadp, 0, sizeof(struct pthread));
+ _thread_kern_threadp->magic = PTHREAD_MAGIC;
+ pthread_set_name_np(_thread_kern_threadp, "kern");
/* Zero the initial thread: */
memset(_thread_initial, 0, sizeof(struct pthread));
@@ -224,6 +226,7 @@ _thread_init(void)
_thread_initial->error = 0;
_thread_initial->magic = PTHREAD_MAGIC;
pthread_set_name_np(_thread_initial, "init");
+ _SPINUNLOCK(&_thread_initial->lock);
_thread_link_list = _thread_initial;
_thread_run = _thread_initial;