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

Diff of /rtmk/thread.c

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

revision 1.21 by jrydberg, Thu Feb 21 23:43:58 2002 UTC revision 1.22 by jrydberg, Wed Mar 6 00:55:01 2002 UTC
# Line 480  thread_invoke (struct thread *old_thread Line 480  thread_invoke (struct thread *old_thread
480          }          }
481        else        else
482          {          {
483              old_thread->swap_fn = continuation;
484              
485            if ((old_thread->sched_state & THREAD_SCHED_STATE)            if ((old_thread->sched_state & THREAD_SCHED_STATE)
486                == THREAD_STATE_RUN)                == THREAD_STATE_RUN)
487              thread_setrun (old_thread, false);              thread_setrun (old_thread, false);
# Line 778  thread_will_priority (struct thread *thr Line 780  thread_will_priority (struct thread *thr
780    
781    spl = SPLOFF ();    spl = SPLOFF ();
782    
 #if 0  
   do  
     {  
       struct thread *t1 = thread, *t2;  
   
       for (t1 = thread; t1;)  
         {  
           for (t2 = thread; t2;)  
             {  
               if (t1 == t2)  
                 panic ("found a dead-lock situation: t1 %p t2 %p\n",  
                        t1, t2);  
   
               if (! t2->blocked_lock)  
                 break;  
               t2 = t2->blocked_lock->owner;  
             }  
783    
784            if (! t1->blocked_lock)    /* Check for deadlock.  We do this by checking if there's a loop
785              break;       in the owner chain of the lock that THREAD owns.  */
786            t1 = t1->blocked_lock->owner;    {
787          }      struct thread_lock *bl;
788      }      struct thread *t1, *t2;
789    while (0);      int i = 0;
790  #endif  
791        for (t1 = thread, bl = thread->blocked_lock; bl; t1 = bl->owner)
792          {
793            for (t2 = bl->owner; t2;)
794              {
795                i++;
796                if (t1 == t2)
797                  panic ("scan %d: found a dead-lock situation: t1 %p t2 %p\n",
798                         i, t1, t2);
799                if (! t2->blocked_lock)
800                  break;
801                t2 = t2->blocked_lock->owner;
802              }
803            bl = t1->blocked_lock;
804          }
805      }
806    
807    while (thread)    while (thread)
808      {      {
# Line 889  thread_sleep (int event, spin_lock_t *lo Line 889  thread_sleep (int event, spin_lock_t *lo
889  void  void
890  thread_wait (int event, struct thread_lock *lock, void (*continuation) ())  thread_wait (int event, struct thread_lock *lock, void (*continuation) ())
891  {  {
892      SPL_T spl = SPLOFF ();
893    
894    assert_wait (event);    assert_wait (event);
895    if (lock)    if (lock)
896      thread_lock_unlock (lock);      thread_lock_unlock (lock);
897    thread_block (continuation);    thread_block (continuation);
898      SPLON (spl);
899  }  }
900    
901  /* Start kernel thread THREAD by calling FN with ARG as first argument.    /* Start kernel thread THREAD by calling FN with ARG as first argument.  

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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