Changeset a33f0a6 in mainline for kernel/generic/src/proc/thread.c
- Timestamp:
- 2011-08-03T17:34:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1940326
- Parents:
- 52a79081 (diff), 3fab770 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
r52a79081 ra33f0a6 55 55 #include <time/clock.h> 56 56 #include <time/timeout.h> 57 #include <time/delay.h> 57 58 #include <config.h> 58 59 #include <arch/interrupt.h> … … 67 68 #include <syscall/copy.h> 68 69 #include <errno.h> 69 70 71 #ifndef LOADED_PROG_STACK_PAGES_NO72 #define LOADED_PROG_STACK_PAGES_NO 173 #endif74 75 70 76 71 /** Thread states */ … … 265 260 */ 266 261 267 list_append(&thread->rq_link, &cpu->rq[i].rq _head);262 list_append(&thread->rq_link, &cpu->rq[i].rq); 268 263 cpu->rq[i].n++; 269 264 irq_spinlock_unlock(&(cpu->rq[i].lock), true); … … 300 295 301 296 /* Not needed, but good for debugging */ 302 memsetb(thread->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES, 0);297 memsetb(thread->kstack, STACK_SIZE, 0); 303 298 304 299 irq_spinlock_lock(&tidlock, true); … … 308 303 context_save(&thread->saved_context); 309 304 context_set(&thread->saved_context, FADDR(cushion), 310 (uintptr_t) thread->kstack, THREAD_STACK_SIZE);305 (uintptr_t) thread->kstack, STACK_SIZE); 311 306 312 307 the_initialize((the_t *) thread->kstack); … … 327 322 thread->cpu = NULL; 328 323 thread->flags = flags; 324 thread->nomigrate = 0; 329 325 thread->state = Entering; 330 326 … … 427 423 atomic_inc(&task->lifecount); 428 424 429 list_append(&thread->th_link, &task->th _head);425 list_append(&thread->th_link, &task->threads); 430 426 431 427 irq_spinlock_pass(&task->lock, &threads_lock); … … 489 485 } 490 486 487 /** Prevent the current thread from being migrated to another processor. */ 488 void thread_migration_disable(void) 489 { 490 ASSERT(THREAD); 491 492 THREAD->nomigrate++; 493 } 494 495 /** Allow the current thread to be migrated to another processor. */ 496 void thread_migration_enable(void) 497 { 498 ASSERT(THREAD); 499 ASSERT(THREAD->nomigrate > 0); 500 501 THREAD->nomigrate--; 502 } 503 491 504 /** Thread sleep 492 505 * … … 605 618 printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n", 606 619 thread->tid, name, thread, thread_states[thread->state], 607 thread->task, thread->task->cont ext);620 thread->task, thread->task->container); 608 621 #endif 609 622 … … 617 630 printf("%-8" PRIu64 " %-14s %18p %-8s %18p %-5" PRIu32 "\n", 618 631 thread->tid, name, thread, thread_states[thread->state], 619 thread->task, thread->task->cont ext);632 thread->task, thread->task->container); 620 633 #endif 621 634 … … 658 671 else 659 672 printf("[id ] [name ] [address ] [state ] [task ]" 660 " [ct x]\n");673 " [ctn]\n"); 661 674 #endif 662 675 … … 667 680 } else 668 681 printf("[id ] [name ] [address ] [state ]" 669 " [task ] [ct x]\n");682 " [task ] [ctn]\n"); 670 683 #endif 671 684 … … 918 931 } 919 932 933 sysarg_t sys_thread_udelay(uint32_t usec) 934 { 935 delay(usec); 936 return 0; 937 } 938 920 939 /** @} 921 940 */
Note:
See TracChangeset
for help on using the changeset viewer.