missing CAS-locks and barriers
authorNikodemus Siivola <nikodemus@sb-studio.net>
Wed, 16 Nov 2011 15:27:15 +0000 (17:27 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 17 Nov 2011 16:30:45 +0000 (18:30 +0200)
commit7bb4c044e09f02a2115095af3733b0673b98a726
treeb7f610f04bc4d3ebafa8dc1c2325954ce2b04d8a
parentd67355bbb5c570cac6fe866113d79ce9de9b51a7
missing CAS-locks and barriers

 * %WAITQUEUE-ENQUEUE was missing the CAS-lock, as was checking for
   the wakeup.

 * Put back the spin-before-yielding loop into WITH-CAS-LOCK, which
   I'd removed for some reason.

 * PPC has threads, and really needs barriers. x86oids have made me
   lazy, and now we pay the price. In particular:

   ** THREAD-WAITING-FOR: a read barrier in the non-futex
      CONDITION-WAIT -- the corresponding writes are protected
      by CAS and hence provide a write barrier already.

      ...and just for symmetry and because this makes my poor
      head hurt add write and read barriers to other places where
      it is read from / written to.

   ** WITH-CAS-LOCK: a read barrier for the READ-FORM. Not strictly
      necessary perhaps, as THREAD-YIELD most probably provides a
      barrier, but this is easier to read. Since the corresponding
      writes should use CAS, we're OK.
src/code/barrier.lisp
src/code/cross-thread.lisp
src/code/target-thread.lisp
src/code/thread.lisp