Am Mo., 9. Aug. 2021 um 07:39 Uhr schrieb Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de>:
 
 

2) I recommend removing thread-terminate! from this SRFI for the reasons given at <https://docs.oracle.com/javase/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html>, and likewise  condition-variable-signal! because, although it is more efficient than condition-variable-broadcast, it is unpredictable unless it is guaranteed that all the threads being waited on do the same thing.

Condition-variable-signal! only wakes up a thread that is waiting on that condition variable, so I don't see how the randomness has be be a problem.

As for thread-terminate!:  I would like to hear Marc's opinion on it as well.  SRFI 18 has the concept of abandoned mutexes to resolve (some of?) the problems stated in the Java document you cited.  There may be use cases of thread-terminate!.  For example, when a Scheme (or some other language) interpreter is written in Scheme and one of its threads executes long-running library code, I may want to be able to kill it quickly.

Notably, the C11 thread API mimics the Posix API but leaves out pthread_cancel.

I would like to add the following note, which will become relevant if thread-terminate! is removed:  In that case, we can drop both terminated-thread-exception? and uncaught-exception? and just raise the exception object in case of an uncaught exception directly.  I would like that.