On Sun, Feb 16, 2025 at 03:23:07PM +0000, Diogo via wrote:
> On Sun, Feb 16, 2025 at 03:22:57PM +0100, felix.winkelm...@bevuta.com wrote:
> >
> > You are doing nothing wrong, it is just a limitation of the runtime system.
> > CHICKEN expects callbacks to be invoked in the same thread as the
> > one that invoked CHICKEN_run()/CHICKEN_initialize(). During
> > initialization, stack-limits are inferred to ensure the generational
> > garbage collector sees when the nursery is exhausted. Different
> > thread have of course wildly different stack addresses, so this
> > will confuse the garbage collector. You could say that this is a severe
> > shortcoming (not necessarily a bug), and we could try to set the limits on
> > every external call-in into the runtime system.
 
Would this work with CRUNCH? If yes, then this is my excusive to give it a try.

My goal is to rewrite a state machine component in Scheme for runtime
monitoring of multithreaded programs. I guess that I'll only need very
basic features from the language, so CRUNCH could potentially work.

> > There is an egg ("concurrent-native-callbacks") that addresses
> > this very issue (calling from multiple threads into compiled
> > CHICKEN code). It is not as elegant or clean as calling from
> > multiple threads directly, but it is at least one possible approach.

I took a look at this library and I think I could use it as plan B.

The problem is that the monitoring library I'm working on captures the execution
of threads. Adding an extra thread (dispatcher) will probably cause a lot of
corner-case checking.

Best,
-Diogo

Reply via email to