clasp icon indicating copy to clipboard operation
clasp copied to clipboard

Threads are often not interruptable

Open Bike opened this issue 5 years ago • 0 comments

For example, if a thread is in a loop, and nothing in that loop allocates heap objects (calls into the garbage collector code) or directly calls core:check-pending-interrupts, that thread will never receive interrupts. By "interrupt" I mean mp:interrupt-process, as well as mp:process-kill and mp:process-suspend which are derived from it.

We have some stub code, wake_up_thread, that is intended to make a thread respond to its queued interrupts due to an operating system signal. It's a stub because we're not prepared to execute arbitrary code at arbitrary points, i.e. we're not generally re-entrant. For example, if we were interrupted just after a function call, the interruption might distort the thread local multiple values array.

Allocation has nothing particular to do with interrupts, but serves as a safe point. We should make more code interruptable. Look at what other implementations do and so on.

Derived from #971

Bike avatar Apr 08 '20 21:04 Bike