[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread support plan with initial patch

From: NIIBE Yutaka
Subject: Re: Thread support plan with initial patch
Date: Thu, 5 Apr 2001 17:57:55 +0900 (JST)

NIIBE Yutaka wrote:
 >  > It actually looks like you're moving the thread switching code to a
 >  > place where scm_ints_disabled can have a different value than now.
 >  > I don't have time to verify this, but if that is true, it could cause
 >  > strange things to happen to the current COOP threads...
 > Yes, I moved it.  I dont' think it causes bad behavior, but I agree to
 > verify and double-check it.

I've checked.  Current code is buggy.  Even after my change, the code
is still buggy.

Here's the case:
  Control goes like (1), (2), (3), (4), (5), (6), and (7).

  In current code:
  Thread A:              (2)(5)                       (6)
            =1                 =0            =1             =0

  Thread B:
  (3)                                            (4)(7)
      =0                  =1          ++=>2            --=> -1         =0
  It results minus value of scm_disable_ints.

  With my change:
  Thread A:                  (2)(5)                       (6)
            =1            =0            =1            =0
  Thread B:
       (3)                                            (4)(7)
   =0                 =1           ++=>2          --=>1            =0
  It enters critical section even if scm_disable_ints==1.
  It comes end of critical section with scm_disable_ints==0.

I think that the switching at REALLOW_INTS should be removed.

After we remove the switching at REALLOW_INTS, semantics is clearer
(we only switch at ALLOW_INTS).  Then, it's ovious that my change has
no effect, and it looks better IMHO.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]