Changeset 481d4751 in mainline
- Timestamp:
- 2010-05-02T18:52:45Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1624aae
- Parents:
- 663bb537
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/scheduler.c
r663bb537 r481d4751 1 1 /* 2 * Copyright (c) 20 01-2007Jakub Jermar2 * Copyright (c) 2010 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; 384 386 385 387 ASSERT(CPU != NULL); 386 388 389 /* 390 * Hold the current task and the address space to prevent their 391 * possible destruction should thread_destroy() be called on this or any 392 * 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 387 399 if (THREAD) { 388 400 /* must be run after the switch to scheduler stack */ … … 476 488 */ 477 489 if (TASK != THREAD->task) { 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); 490 as_t *new_as = THREAD->task->as; 490 491 491 492 /* … … 493 494 * space. 494 495 */ 495 if ( as1 != as2) {496 if (old_as != new_as) { 496 497 /* 497 498 * Both tasks and address spaces are different. 498 499 * Replace the old one with the new one. 499 500 */ 500 as_switch( as1, as2);501 as_switch(old_as, new_as); 501 502 } 503 502 504 TASK = THREAD->task; 503 505 before_task_runs(); 504 506 } 505 507 508 if (old_task) 509 task_release(old_task); 510 if (old_as) 511 as_release(old_as); 512 506 513 spinlock_lock(&THREAD->lock); 507 514 THREAD->state = Running;
Note:
See TracChangeset
for help on using the changeset viewer.