/[rtmk]/rtmk/thread.c
ViewVC logotype

Diff of /rtmk/thread.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by jrydberg, Mon Jan 7 01:16:21 2002 UTC revision 1.11 by jrydberg, Mon Jan 7 02:25:24 2002 UTC
# Line 95  stack_alloc (struct thread *thread, void Line 95  stack_alloc (struct thread *thread, void
95    STACK_ATTACH (thread, stack, continuation);    STACK_ATTACH (thread, stack, continuation);
96  }  }
97    
98    /* Reaper thread continuation.  
99       This deallocates memory used by terminated threads.  */
100    
101    void
102    reaper_continuation (void)
103    {
104      /* ??? dead code right now.  */
105      thread_sleep (0xdeadbeef, 0, reaper_continuation);
106    }
107    
108  /* Create a new thread in TASK.  The thread is returned in THREADP.  */  /* Create a new thread in TASK.  The thread is returned in THREADP.  */
109    
110  kern_return_t  kern_return_t
# Line 529  thread_block (void (*continuation) ()) Line 539  thread_block (void (*continuation) ())
539    SPLON (spl);    SPLON (spl);
540  }  }
541    
542    /* Try to run NEW_THREAD on current processor.  If we could not invoke
543       it, select another thread and try that one.  */
544    
545    void
546    thread_go (struct thread *new_thread, void (*continuation) ())
547    {
548      struct thread *thread = THREAD_CURRENT ();
549      SPL_T spl;
550    
551      spl = SPLOFF ();
552    
553      while (! thread_invoke (thread, continuation, new_thread));
554        new_thread = thread_select (PROCESSOR_CURRENT ());
555    
556      SPLON (spl);
557    }
558    
559    
560  /* Will current threads priority to THREAD and all threads that THREAD  /* Will current threads priority to THREAD and all threads that THREAD
561     is blocking on.  */     is blocking on.  */
562    
# Line 740  thread_setrun (struct thread *thread, bo Line 768  thread_setrun (struct thread *thread, bo
768      {      {
769        if (processor->state == PROCESSOR_STATE_IDLE)        if (processor->state == PROCESSOR_STATE_IDLE)
770          {          {
           processor->next_thread = thread;  
771            processor->state = PROCESSOR_STATE_DISPATCH;            processor->state = PROCESSOR_STATE_DISPATCH;
772              processor_send_dispatch_ipi (processor, thread);
773            /* ??? send interrupt to processor.  */            return;
774          }          }
775      }      }
776    
# Line 756  thread_setrun (struct thread *thread, bo Line 783  thread_setrun (struct thread *thread, bo
783    
784        if (processor->state == PROCESSOR_STATE_IDLE)        if (processor->state == PROCESSOR_STATE_IDLE)
785          {          {
           processor->next_thread = thread;  
786            processor->state = PROCESSOR_STATE_DISPATCH;            processor->state = PROCESSOR_STATE_DISPATCH;
787                        processor_send_dispatch_ipi (processor, thread);
788            /* ??? send interrupt to processor.  */            return;
   
789          }          }
790    #if 0
791        else if (processor->state == PROCESSOR_STATE_RUNNING &&        else if (processor->state == PROCESSOR_STATE_RUNNING &&
792                 thread->sched_premul > processor->current_thread->sched_premul)                 thread->sched_premul > processor->current_thread->sched_premul)
793          {          {
794            /* ??? send interrupt to processor.  */            processor->state = PROCESSOR_STATE_DISPATCH;
795              processor_send_dispatch_ipi (processor, thread);
796          }          }
797    #endif
798      }      }
799  #endif  #endif
800    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26