On Mon Oct 5, 2026 at 8:18 PM CEST, Sasha Reinhard via Chicken-users wrote: > > I'm not sure where the best place is to ask this. But what's the > recommended way to prevent the quantum context switching threads? I only > want it to context switch when I have a thread-yield or blocking I/O, and > not automatically based on a 10ms timer. This would imitate asyncio from > python pretty well for me. Because then I wouldn't need any mutex logic > since I'm guaranteed that it won't context switch in the middle of an > operation. > > A workaround I found is setting the quantum via thread-quantum-set! to an > absurdly large number, in hopes it won't ever reach it. And another > workaround is disabling interrupts for my compile unit, but this doesn't > help if an egg I use has interrupts enabled again. I was looking through > the source and found C_interrupts_enabled which doesn't seem to have any > method for setting it. Would this be the variable I should set? I'm worried > I might cause the garbage collector to break if I mess with it. I'm not > sure how it ties into all this.
You won't break GC when disabling interrupts. What you require should be relatively easy, I just need to investigate a little to find the cleanest way. I'll get back to you. > > Also an unrelated thingy, but the documentation for thread-quantum says it > returns a value in milleseconds, but it returns 10,000. And in the code it > seems this timer works by decrementing 10,000 by 1 each time it encounters > a C_check_for_interrupt which may not be every microsecond right? The counter is definitely not a time value. Where does it say it's milliseconds? I can't find it in the manual, nor SRFI-18... cheers, felix
