Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 797 Bytes

rontolisp-destroy-thread.md

File metadata and controls

21 lines (16 loc) · 797 Bytes

rontolisp:destroy-thread

(rontolisp:destroy-thread thread)

Interrupts the thread behind the handle and returns the handle. A thread blocked in a waiting operation unblocks with an error there; like Java's Thread.interrupt, a body that never blocks may run to completion anyway — this is a request, not a kill.

(let ((th (rontolisp:make-thread (lambda () 1))))
  (rontolisp:join-thread th)
  (rontolisp:threadp (rontolisp:destroy-thread th))) ; => T

Limitations

  • Delivery is asynchronous: thread-alive-p may still answer t for a moment after this returns.
  • A value that is not a thread handle signals a type-error expecting (SATISFIES RONTOLISP:THREADP).
  • Interpreter and JVM backend only, like rontolisp:make-thread itself.