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

Diff of /rtmk/thread.c

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

revision 1.14 by jrydberg, Wed Jan 16 00:07:57 2002 UTC revision 1.15 by jrydberg, Tue Jan 29 18:31:45 2002 UTC
# Line 659  thread_interrupt (struct thread *thread) Line 659  thread_interrupt (struct thread *thread)
659  kern_return_t  kern_return_t
660  thread_resume (struct thread *thread)  thread_resume (struct thread *thread)
661  {  {
662      SPL_T spl;
663    
664    /* lock thread.  */    /* lock thread.  */
665      spl = SPLOFF ();
666    thread_lock (thread);    thread_lock (thread);
667    
668    if (--thread->suspend_cnt == 0)    if (--thread->suspend_cnt == 0)
669      {      {
670        SPL_T spl;  
   
671        thread->sched_state &= ~THREAD_STATE_SUSPEND;        thread->sched_state &= ~THREAD_STATE_SUSPEND;
672        thread->sched_state |=  THREAD_STATE_RUN;        thread->sched_state |=  THREAD_STATE_RUN;
673        thread_unlock (thread);        thread_unlock (thread);
   
       spl = SPLOFF ();  
674        thread_setrun (thread, true);        thread_setrun (thread, true);
675        SPLON (spl);        SPLON (spl);
   
676        return KERN_SUCCESS;        return KERN_SUCCESS;
677      }      }
678    thread_unlock (thread);    thread_unlock (thread);
679      SPLON (spl);
680      
681    return KERN_SUCCESS;    return KERN_SUCCESS;
682  }  }
683    
# Line 746  thread_will_priority (struct thread *thr Line 746  thread_will_priority (struct thread *thr
746    
747    spl = SPLOFF ();    spl = SPLOFF ();
748    
749    #if DIAGNOSTICS
750      do
751        {
752          struct thread *t1 = thread, *t2;
753    
754          for (t1 = thread; t1;)
755            {
756              for (t2 = thread; t2;)
757                {
758                  if (t1 == t2)
759                    panic ("found a dead-lock situation: t1 %p t2 %p\n",
760                           t1, t2);
761    
762                  if (! t2->blocked_lock)
763                    break;
764                  t2 = t2->blocked_lock->owner;
765                }
766    
767              if (! t1->blocked_lock)
768                break;
769              t1 = t1->blocked_lock->owner;
770            }
771        }
772      while (0);
773    #endif
774    
775    while (thread)    while (thread)
776      {      {
777        thread_lock (thread);        thread_lock (thread);
# Line 1043  thread_set_priority (struct thread *thre Line 1069  thread_set_priority (struct thread *thre
1069    if (policy < 0 || policy > 2 || priority < 0 || priority > 127)    if (policy < 0 || policy > 2 || priority < 0 || priority > 127)
1070      return KERN_FAILURE; /* ??? */      return KERN_FAILURE; /* ??? */
1071    
   thread_lock (thread);  
1072    spl = SPLOFF ();    spl = SPLOFF ();
1073      thread_lock (thread);
1074    
1075    thread->sched_policy   = policy;    thread->sched_policy   = policy;
1076    thread->sched_priority = (priority >> 3);    thread->sched_priority = (priority >> 3);
1077    thread->sched_sp       = & sched_policies [policy];    thread->sched_sp       = & sched_policies [policy];
1078    CALC_PREMUL (thread);    CALC_PREMUL (thread);
1079    
   SPLON (spl);  
1080    thread_unlock (thread);    thread_unlock (thread);
1081      SPLON (spl);
1082    
1083    return KERN_SUCCESS;    return KERN_SUCCESS;
1084  }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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