Fixes for a couple of threading bugs found by Gilbert Baumann
... CONDITION-WAIT should acquire the lock with the correct
value (i.e. the one it had when it went to sleep), not
just the default value.
... CONDITION-NOTIFY should get the queue spinlock before
signalling, making it atomic wrt WAIT-ON-QUEUE
Added rudimentary thread test script that I thought I'd
committed on some previous occasion