> > > > [/linuxthreads/ex10.out] Error 143 > > > - Had to kill one thread to pass this test. > > > - This worries me... > > > > Look at this last. >
Putting together my Changelog has made me realize that I probably have to check spinlock.c again... 496 if (oldstatus != 0) { 497 if (timedsuspend(self, abstime) == 0) { 498 if (!testandset(&p_wait_node->abandoned)) 499 return 0; /* Timeout! */ 500 501 /* Eat oustanding resume from owner, otherwise wait_node_free() below 502 will race with owner's wait_node_dequeue(). */ 503 suspend(self); 504 } 505 } I'm thinking of my implementation of testandset... __load_and_clear(__atomic_lock_t *spinlock) { int ret; __asm__ __volatile__( "ldcw 0(%2),%0" : "=r"(ret), "=m"(*spinlock) : "r"(spinlock)); return ret; } /* Emulate testandset */ PT_EI long int testandset(__atomic_lock_t *spinlock) { return (__load_and_clear(spinlock) == 0); } Normally: HPPA Emulated: x = 0 x = 1 temp = x temp = x *x = 1 *x = 0 te(0)mp (te(1)mp==0) x = 1 x = 0 temp = x temp = x *x = 1 *x = 0 te(1)mp (te(0)mp==0) Looks correct. Perhaps I've missed a race somewhere... more work for another day :) c.