Changes in kernel/generic/src/proc/scheduler.c [481d4751:37c9fc8] in mainline
- File:
-
- 1 edited
-
kernel/generic/src/proc/scheduler.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/scheduler.c
r481d4751 r37c9fc8 1 1 /* 2 * Copyright (c) 20 10Jakub Jermar2 * Copyright (c) 2001-2007 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 382 382 int priority; 383 383 DEADLOCK_PROBE_INIT(p_joinwq); 384 task_t *old_task = TASK;385 as_t *old_as = AS;386 384 387 385 ASSERT(CPU != NULL); 388 386 389 /*390 * Hold the current task and the address space to prevent their391 * possible destruction should thread_destroy() be called on this or any392 * other processor while the scheduler is still using them.393 */394 if (old_task)395 task_hold(old_task);396 if (old_as)397 as_hold(old_as);398 399 387 if (THREAD) { 400 388 /* must be run after the switch to scheduler stack */ … … 488 476 */ 489 477 if (TASK != THREAD->task) { 490 as_t *new_as = THREAD->task->as; 478 as_t *as1 = NULL; 479 as_t *as2; 480 481 if (TASK) { 482 spinlock_lock(&TASK->lock); 483 as1 = TASK->as; 484 spinlock_unlock(&TASK->lock); 485 } 486 487 spinlock_lock(&THREAD->task->lock); 488 as2 = THREAD->task->as; 489 spinlock_unlock(&THREAD->task->lock); 491 490 492 491 /* … … 494 493 * space. 495 494 */ 496 if ( old_as != new_as) {495 if (as1 != as2) { 497 496 /* 498 497 * Both tasks and address spaces are different. 499 498 * Replace the old one with the new one. 500 499 */ 501 as_switch(old_as, new_as); 502 } 503 500 as_switch(as1, as2); 501 } 504 502 TASK = THREAD->task; 505 503 before_task_runs(); 506 504 } 507 505 508 if (old_task)509 task_release(old_task);510 if (old_as)511 as_release(old_as);512 513 506 spinlock_lock(&THREAD->lock); 514 507 THREAD->state = Running;
Note:
See TracChangeset
for help on using the changeset viewer.
