OpenComputers II

OpenComputers II

27.1k Downloads

A hook-based way to use redstone interface

heipiao233 opened this issue ยท 5 comments

commented

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

commented

Is that possible if we write a driver? I just know something about it.

commented

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.

commented

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?

commented

Basically something like an interrupt?

commented

Basically something like an interrupt?

yes