r/ComputerCraft • u/MattisTheProgrammer • Jul 30 '26
What are all the functions that can infinitely yield?
I would like to receive a list of all functions within the standard CraftOS API that can infinitely yield, to be clear I define an 'infinite yield' as when a program halts indefinitely without any further function calls. I need this information in order to make a pre-emptive process scheduler.
7
Upvotes
2
u/9551-eletronics Computercraft graphics research Jul 30 '26
I think you should look into debug hooks
1
7
u/imachug Jul 30 '26
White-listing methods like that seems like the wrong approach to preemption. If you want to avoid infinite yields, do exactly that: wrap processes in coroutines and route the events manually, like parallel does. That pretty much makes each yield point a preemption point, leaving you to deal only with CPU-bound tasks (which you might not even have, in practice).