Show
Ignore:
Timestamp:
05/20/10 16:05:25 (2 years ago)
Author:
mwhitworth
Message:

Add to TCP/IP stack.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/netchannel/kernel/thread.c

    r1677 r2085  
    142142 
    143143        if (thread == currThread) 
    144                 ArchSwitchStackCall(exitStack+PAGE_SIZE/4,_ThrFreeThread,thread); 
     144                ArchSwitchStackCall(exitStack + (PAGE_SIZE >> 2),_ThrFreeThread,thread); 
    145145        else{ 
    146146                MemFree((void*)(thread->currStack)); 
     
    233233 ***********************************************************************/ 
    234234 
    235 void ThrSuspendThread(struct Thread* thread) 
     235void ThrDoSuspendThread(struct Thread* thread, int state) 
    236236{ 
    237237        if (thread == idleTask) 
    238238                KernelPanic("Idle task being suspended - driver sleeping in interrupt?"); 
    239239 
     240        SpinLockIrq(&thrListLock); 
     241 
    240242        if (LIKELY(thread->state == THR_RUNNING)) 
    241243        { 
    242                 SpinLockIrq(&thrListLock); 
    243244                --nrRunning; 
    244                 thread->state=THR_PAUSED; 
    245                 SpinUnlockIrq(&thrListLock); 
    246         } 
     245                thread->state = state; 
     246        } 
     247 
     248        SpinUnlockIrq(&thrListLock); 
     249} 
     250 
     251void ThrSuspendThread(struct Thread* thread) 
     252{ 
     253        ThrDoSuspendThread(thread, THR_PAUSED); 
    247254} 
    248255 
    249256SYMBOL_EXPORT(ThrSuspendThread); 
    250257 
     258void ThrSuspendThreadInt(struct Thread* thread) 
     259{ 
     260        ThrDoSuspendThread(thread, THR_INTERRUPTIBLE); 
     261} 
     262 
     263SYMBOL_EXPORT(ThrSuspendThreadInt); 
     264 
    251265/*********************************************************************** 
    252266 * 
    253267 * FUNCTION:    ThrResumeThread 
    254268 * 
    255  * DESCRIPTION: Resume a paused thread, and signal scheduling if it's of 
    256  *                              a higher priority. 
     269 * DESCRIPTION: Resume a paused thread. 
    257270 * 
    258271 * PARAMETERS:  thread - the thread in question. 
     
    268281                ThrStartThread(thread); 
    269282                if (thread->quantums >= currThread->quantums) 
    270                         thrNeedSchedule=true; 
     283                        thrNeedSchedule = true; 
    271284        } 
    272285}