Changes in kernel/generic/src/proc/thread.c [ae0300b5:c0699467] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
rae0300b5 rc0699467 39 39 #include <proc/thread.h> 40 40 #include <proc/task.h> 41 #include <proc/uarg.h>42 41 #include <mm/frame.h> 43 42 #include <mm/page.h> … … 45 44 #include <arch/cycle.h> 46 45 #include <arch.h> 47 #include <synch/synch.h>48 46 #include <synch/spinlock.h> 49 47 #include <synch/waitq.h> … … 55 53 #include <time/clock.h> 56 54 #include <time/timeout.h> 55 #include <time/delay.h> 57 56 #include <config.h> 58 57 #include <arch/interrupt.h> … … 67 66 #include <syscall/copy.h> 68 67 #include <errno.h> 69 70 71 #ifndef LOADED_PROG_STACK_PAGES_NO72 #define LOADED_PROG_STACK_PAGES_NO 173 #endif74 75 68 76 69 /** Thread states */ … … 265 258 */ 266 259 267 list_append(&thread->rq_link, &cpu->rq[i].rq _head);260 list_append(&thread->rq_link, &cpu->rq[i].rq); 268 261 cpu->rq[i].n++; 269 262 irq_spinlock_unlock(&(cpu->rq[i].lock), true); … … 300 293 301 294 /* Not needed, but good for debugging */ 302 memsetb(thread->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES, 0);295 memsetb(thread->kstack, STACK_SIZE, 0); 303 296 304 297 irq_spinlock_lock(&tidlock, true); … … 308 301 context_save(&thread->saved_context); 309 302 context_set(&thread->saved_context, FADDR(cushion), 310 (uintptr_t) thread->kstack, THREAD_STACK_SIZE);303 (uintptr_t) thread->kstack, STACK_SIZE); 311 304 312 305 the_initialize((the_t *) thread->kstack); … … 327 320 thread->cpu = NULL; 328 321 thread->flags = flags; 322 thread->nomigrate = 0; 329 323 thread->state = Entering; 330 324 … … 427 421 atomic_inc(&task->lifecount); 428 422 429 list_append(&thread->th_link, &task->th _head);423 list_append(&thread->th_link, &task->threads); 430 424 431 425 irq_spinlock_pass(&task->lock, &threads_lock); … … 489 483 } 490 484 485 /** Prevent the current thread from being migrated to another processor. */ 486 void thread_migration_disable(void) 487 { 488 ASSERT(THREAD); 489 490 THREAD->nomigrate++; 491 } 492 493 /** Allow the current thread to be migrated to another processor. */ 494 void thread_migration_enable(void) 495 { 496 ASSERT(THREAD); 497 ASSERT(THREAD->nomigrate > 0); 498 499 THREAD->nomigrate--; 500 } 501 491 502 /** Thread sleep 492 503 * … … 605 616 printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n", 606 617 thread->tid, name, thread, thread_states[thread->state], 607 thread->task, thread->task->cont ext);618 thread->task, thread->task->container); 608 619 #endif 609 620 … … 617 628 printf("%-8" PRIu64 " %-14s %18p %-8s %18p %-5" PRIu32 "\n", 618 629 thread->tid, name, thread, thread_states[thread->state], 619 thread->task, thread->task->cont ext);630 thread->task, thread->task->container); 620 631 #endif 621 632 … … 658 669 else 659 670 printf("[id ] [name ] [address ] [state ] [task ]" 660 " [ct x]\n");671 " [ctn]\n"); 661 672 #endif 662 673 … … 667 678 } else 668 679 printf("[id ] [name ] [address ] [state ]" 669 " [task ] [ct x]\n");680 " [task ] [ctn]\n"); 670 681 #endif 671 682 … … 918 929 } 919 930 931 sysarg_t sys_thread_udelay(uint32_t usec) 932 { 933 delay(usec); 934 return 0; 935 } 936 920 937 /** @} 921 938 */
Note:
See TracChangeset
for help on using the changeset viewer.