1 |
/* Allocate a new thread structure. |
/* Allocate a new thread structure. |
2 |
Copyright (C) 2000, 2002 Free Software Foundation, Inc. |
Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. |
3 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
4 |
|
|
5 |
The GNU C Library is free software; you can redistribute it and/or |
The GNU C Library is free software; you can redistribute it and/or |
139 |
|
|
140 |
if (__pthread_num_threads < __pthread_max_threads) |
if (__pthread_num_threads < __pthread_max_threads) |
141 |
{ |
{ |
142 |
/* We have a free slot. Use the slot number as |
/* We have a free slot. Use the slot number plus one as the |
143 |
the thread ID for the new thread. */ |
thread ID for the new thread. */ |
144 |
new->thread = __pthread_num_threads++; |
new->thread = 1 + __pthread_num_threads++; |
145 |
__pthread_threads[new->thread] = NULL; |
__pthread_threads[new->thread - 1] = NULL; |
146 |
|
|
147 |
pthread_rwlock_unlock (&__pthread_threads_lock); |
pthread_rwlock_unlock (&__pthread_threads_lock); |
148 |
|
|
203 |
__pthread_threads = threads; |
__pthread_threads = threads; |
204 |
|
|
205 |
/* And allocate ourselves one of the newly created slots. */ |
/* And allocate ourselves one of the newly created slots. */ |
206 |
new->thread = __pthread_num_threads++; |
new->thread = 1 + __pthread_num_threads++; |
207 |
__pthread_threads[new->thread] = NULL; |
__pthread_threads[new->thread - 1] = NULL; |
208 |
|
|
209 |
pthread_rwlock_unlock (&__pthread_threads_lock); |
pthread_rwlock_unlock (&__pthread_threads_lock); |
210 |
|
|