From c46380de65ed5089fea4a19cd9797ce5f1e47f1c Mon Sep 17 00:00:00 2001 From: tedu Date: Sun, 18 Dec 2005 01:35:06 +0000 Subject: initialize all spinlocks to _SPINLOCK_UNLOCKED --- lib/librthread/rthread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/librthread/rthread.c') diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c index c1916bc0937..e611b2fdd93 100644 --- a/lib/librthread/rthread.c +++ b/lib/librthread/rthread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread.c,v 1.7 2005/12/14 06:07:54 tedu Exp $ */ +/* $OpenBSD: rthread.c,v 1.8 2005/12/18 01:35:06 tedu Exp $ */ /* * Copyright (c) 2004 Ted Unangst * All Rights Reserved. @@ -39,7 +39,7 @@ static int threads_ready; static pthread_t thread_list; -static _spinlock_lock_t thread_lock; +static _spinlock_lock_t thread_lock = _SPINLOCK_UNLOCKED; int getthrid(); void threxit(int); @@ -103,6 +103,7 @@ thread_init(void) thread = malloc(sizeof(*thread)); memset(thread, 0, sizeof(*thread)); thread->tid = getthrid(); + thread->donesem.lock = _SPINLOCK_UNLOCKED; thread->flags |= THREAD_CANCEL_ENABLE|THREAD_CANCEL_DEFERRED; snprintf(thread->name, sizeof(thread->name), "Main process"); thread_list = thread; @@ -200,6 +201,7 @@ pthread_create(pthread_t *threadp, const pthread_attr_t *attr, thread = malloc(sizeof(*thread)); memset(thread, 0, sizeof(*thread)); + thread->donesem.lock = _SPINLOCK_UNLOCKED; thread->fn = start_routine; thread->arg = arg; @@ -352,7 +354,7 @@ _thread_dump_info(void) /* * the malloc lock */ -static _spinlock_lock_t malloc_lock; +static _spinlock_lock_t malloc_lock = _SPINLOCK_UNLOCKED; void _thread_malloc_lock() -- cgit v1.2.3-59-g8ed1b