diff options
| author | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-25 08:35:37 +0000 |
|---|---|---|
| committer | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-25 08:35:37 +0000 |
| commit | 4393f2c4ecb1499c83e5a9a9bac0c0ada2871abf (patch) | |
| tree | 9b6297b8ba0a9925e192db8989f6e5fb4bcfc958 /lib/libthr | |
| parent | 71d09bc86add29bb88cb5cf14e1403077f9b512c (diff) | |
Notes
Diffstat (limited to 'lib/libthr')
| -rw-r--r-- | lib/libthr/thread/thr_create.c | 14 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_find_thread.c | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index 334dc12a1901..30334211f1c5 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -155,16 +155,14 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, new_thread->flags = 0; /* - * Protect the scheduling queues. - */ - GIANT_LOCK(curthread); - - /* * Initialise the unique id which GDB uses to * track threads. */ new_thread->uniqueid = next_uniqueid++; + THREAD_LIST_LOCK; + _thread_critical_enter(new_thread); + /* * Check if the garbage collector thread * needs to be started. @@ -174,6 +172,8 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, /* Add the thread to the linked list of all threads: */ TAILQ_INSERT_HEAD(&_thread_list, new_thread, tle); + THREAD_LIST_UNLOCK; + /* * Create the thread. * @@ -190,11 +190,11 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, PANIC("thr_create"); } - GIANT_UNLOCK(curthread); - /* Return a pointer to the thread structure: */ (*thread) = new_thread; + _thread_critical_exit(new_thread); + /* * Start a garbage collector thread * if necessary. diff --git a/lib/libthr/thread/thr_find_thread.c b/lib/libthr/thread/thr_find_thread.c index 1b34f2fe9645..bd51b8fa0bc3 100644 --- a/lib/libthr/thread/thr_find_thread.c +++ b/lib/libthr/thread/thr_find_thread.c @@ -44,7 +44,7 @@ _find_thread(pthread_t pthread) if (pthread == NULL || pthread->magic != PTHREAD_MAGIC) return(EINVAL); - GIANT_LOCK(curthread); + THREAD_LIST_LOCK; /* Search for the specified thread: */ TAILQ_FOREACH(pthread1, &_thread_list, tle) { @@ -52,7 +52,7 @@ _find_thread(pthread_t pthread) break; } - GIANT_UNLOCK(curthread); + THREAD_LIST_UNLOCK; /* Return zero if the thread exists: */ return ((pthread1 != NULL) ? 0:ESRCH); |
