Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r26aafe8 rc0699467  
    3939#include <proc/thread.h>
    4040#include <proc/task.h>
    41 #include <proc/uarg.h>
    4241#include <mm/frame.h>
    4342#include <mm/page.h>
     
    4544#include <arch/cycle.h>
    4645#include <arch.h>
    47 #include <synch/synch.h>
    4846#include <synch/spinlock.h>
    4947#include <synch/waitq.h>
     
    5553#include <time/clock.h>
    5654#include <time/timeout.h>
     55#include <time/delay.h>
    5756#include <config.h>
    5857#include <arch/interrupt.h>
     
    259258         */
    260259       
    261         list_append(&thread->rq_link, &cpu->rq[i].rq_head);
     260        list_append(&thread->rq_link, &cpu->rq[i].rq);
    262261        cpu->rq[i].n++;
    263262        irq_spinlock_unlock(&(cpu->rq[i].lock), true);
     
    321320        thread->cpu = NULL;
    322321        thread->flags = flags;
     322        thread->nomigrate = 0;
    323323        thread->state = Entering;
    324324       
     
    421421                atomic_inc(&task->lifecount);
    422422       
    423         list_append(&thread->th_link, &task->th_head);
     423        list_append(&thread->th_link, &task->threads);
    424424       
    425425        irq_spinlock_pass(&task->lock, &threads_lock);
     
    481481        /* Not reached */
    482482        while (true);
     483}
     484
     485/** Prevent the current thread from being migrated to another processor. */
     486void 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. */
     494void thread_migration_enable(void)
     495{
     496        ASSERT(THREAD);
     497        ASSERT(THREAD->nomigrate > 0);
     498
     499        THREAD->nomigrate--;
    483500}
    484501
     
    912929}
    913930
     931sysarg_t sys_thread_udelay(uint32_t usec)
     932{
     933        delay(usec);
     934        return 0;
     935}
     936
    914937/** @}
    915938 */
Note: See TracChangeset for help on using the changeset viewer.