(Just seeing the above patch now. Will try it out now...)
The attached standalone testcase just uses three threads: we try to terminate T2 around the time when T1 exists, this way, T3 is never woken up.
tests$ while sbcl --script wait-on-semaphore.script.lisp ; do true ; done ::: Running (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) .-. ::: Success (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) ::: Running (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) .-. [ 0.1s] 1 safe remaining: T3 [ 0.2s] 0 safe remaining ::: Success (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) ::: Running (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) .-. ::: Success (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) ::: Running (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) .-. ::: Success (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) ::: Running (SEMAPHORE-NOTIFICATION WAIT-ON-SEMAPHORE) .-. [ 0.1s] 1 safe remaining: T3 *** Notes: ("T1" 0 71) *** Inc's: ("T1" 0 81) *** Kills: ("T2" T 81 81) Backtrace for: #<THREAD "T3" RUNNING {1003694443}> 0: ("bogus stack frame") 1: ((FLET #:WITHOUT-INTERRUPTS-BODY-575 :IN CONDITION-WAIT)) 2: (CONDITION-WAIT #<WAITQUEUE {1003693953}> #<MUTEX (free) {1003693923}> :TIMEOUT NIL) 3: ((FLET SB-THREAD::WITH-SYSTEM-MUTEX-THUNK :IN WAIT-ON-SEMAPHORE))
(Just seeing the above patch now. Will try it out now...)
The attached standalone testcase just uses three threads:
we try to terminate T2 around the time when T1 exists,
this way, T3 is never woken up.
tests$ while sbcl --script wait-on- semaphore. script. lisp ; do true ; done NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) NOTIFICATION WAIT-ON-SEMAPHORE) INTERRUPTS- BODY-575 :IN CONDITION-WAIT)) :WITH-SYSTEM- MUTEX-THUNK :IN WAIT-ON-SEMAPHORE))
::: Running (SEMAPHORE-
.-.
::: Success (SEMAPHORE-
::: Running (SEMAPHORE-
.-.
[ 0.1s] 1 safe remaining: T3
[ 0.2s] 0 safe remaining
::: Success (SEMAPHORE-
::: Running (SEMAPHORE-
.-.
::: Success (SEMAPHORE-
::: Running (SEMAPHORE-
.-.
::: Success (SEMAPHORE-
::: Running (SEMAPHORE-
.-.
[ 0.1s] 1 safe remaining: T3
*** Notes:
("T1" 0 71)
*** Inc's:
("T1" 0 81)
*** Kills:
("T2" T 81 81)
Backtrace for: #<THREAD "T3" RUNNING {1003694443}>
0: ("bogus stack frame")
1: ((FLET #:WITHOUT-
2: (CONDITION-WAIT #<WAITQUEUE {1003693953}> #<MUTEX (free) {1003693923}> :TIMEOUT NIL)
3: ((FLET SB-THREAD: