Changeset 7509ddc in mainline for generic/src/proc/thread.c
- Timestamp:
- 2006-06-04T21:54:49Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34dcd3f
- Parents:
- 2cb5e64
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/proc/thread.c
r2cb5e64 r7509ddc 234 234 void thread_destroy(thread_t *t) 235 235 { 236 bool destroy_task = false; 237 236 238 ASSERT(t->state == Exiting); 237 239 ASSERT(t->task); … … 242 244 t->cpu->fpu_owner=NULL; 243 245 spinlock_unlock(&t->cpu->lock); 246 247 spinlock_unlock(&t->lock); 248 249 spinlock_lock(&threads_lock); 250 btree_remove(&threads_btree, (btree_key_t) ((__address ) t), NULL); 251 spinlock_unlock(&threads_lock); 244 252 245 253 /* … … 248 256 spinlock_lock(&t->task->lock); 249 257 list_remove(&t->th_link); 250 spinlock_unlock(&t->task->lock); 251 252 spinlock_unlock(&t->lock); 253 254 spinlock_lock(&threads_lock); 255 btree_remove(&threads_btree, (btree_key_t) ((__address ) t), NULL); 256 spinlock_unlock(&threads_lock); 258 if (--t->task->refcount == 0) { 259 t->task->accept_new_threads = false; 260 destroy_task = true; 261 } 262 spinlock_unlock(&t->task->lock); 263 264 if (destroy_task) 265 task_destroy(t->task); 257 266 258 267 slab_free(thread_slab, t); … … 320 329 t->in_copy_from_uspace = false; 321 330 t->in_copy_to_uspace = false; 322 331 332 t->interrupted = false; 323 333 t->detached = false; 324 334 waitq_initialize(&t->join_wq); … … 330 340 t->fpu_context_exists = 0; 331 341 t->fpu_context_engaged = 0; 332 333 /*334 * Register this thread in the system-wide list.335 */336 ipl = interrupts_disable();337 spinlock_lock(&threads_lock);338 btree_insert(&threads_btree, (btree_key_t) ((__address) t), (void *) t, NULL);339 spinlock_unlock(&threads_lock);340 342 341 343 /* … … 343 345 */ 344 346 spinlock_lock(&task->lock); 347 if (!task->accept_new_threads) { 348 spinlock_unlock(&task->lock); 349 slab_free(thread_slab, t); 350 return NULL; 351 } 345 352 list_append(&t->th_link, &task->th_head); 353 task->refcount++; 346 354 spinlock_unlock(&task->lock); 355 356 /* 357 * Register this thread in the system-wide list. 358 */ 359 ipl = interrupts_disable(); 360 spinlock_lock(&threads_lock); 361 btree_insert(&threads_btree, (btree_key_t) ((__address) t), (void *) t, NULL); 362 spinlock_unlock(&threads_lock); 347 363 348 364 interrupts_restore(ipl);
Note:
See TracChangeset
for help on using the changeset viewer.