oc2
oc2 copied to clipboard
A hook-based way to use redstone interface
Is your feature request related to a problem? Please describe. Sometimes we have to listen many redstone interfaces, so we can do it through polling. But this way is very slow, and if we are listening for short redstone signals like a button, the program may cannot receive the signal.
Describe the solution you'd like Keep the old way, and add a new way: when the interface receives signal, call the hook function.
Describe alternatives you've considered No
This is impossible with the RISC-V architecture since the OS manages all I/O, devices cannot force the CPU to jump to a function unless it's an interrupt, in which case you'll need a custom kernel.
Is that possible if we write a driver? I just know something about it.
Would software-hooks be a viable option, or would implementing hooks on top of current system potentially lead to loss of extremely quick signals? If the program is structured well and doesn't hold control for too long, could it not do cooperative multitasking and have event handlers?
Basically something like an interrupt?
Basically something like an interrupt?
yes