Re: native busy loop and thread-terminate!

Jens Thiele <[email protected]> Tue, 28 Jan 2025 20:35:10 +0100
Newsgroups gmane.lisp.scheme.gauche
Message-ID <[email protected]>
Shiro Kawai <[email protected]> writes:

> Aah, right. On Unix-based systems, thread-terminate! uses a signal to tell
> the target to terminate.  It can't be intercepted by Scheme-level, but it
> is still queued by the receiving side, and only becomes effective when the
> thread calls Scm_SigCheck()---usually from the VM loop.

> I think the supposed way is that C extension code needs to invoke
> Scm_SigCheck() occasionally if it doesn't return control to Scheme.

thanks!
will try to use Scm_SigCheck. Looking at data.queue as example.

> But that can't be enforced, especially if it's in the third party
> code.
>
> We can employ a similar handling mechanism like typing ^C several times to
> force gosh quit.  That is, thread-terminate! resends thread termination
> signal after a short wait, and if the receiving side gets multiple
> termination signal queued, it terminates the thread then.

I see you created an issue for that:
https://github.com/shirok/Gauche/issues/1106

Jens