Menu

New stuff

Due to the need for non-blocking reading of characters from stdio (so the main loop in controlix.vhdl which precesses the master system clock can run at maximum speed), I have created a non-blocking getchar() and a native-code kbhit() function to go with it. This stuff has been used in a new non-blocking gets(), and the code in shell.vhdl has in turn been made polled and the polling update called from the main loop in controlix.vhdl.

"Why not use proper multithreaded I/O?" you might ask. And yes, normally you would run a I/O provider thread which made standard blocking I/O reads and share locked access between that thread and the main (or another) thread to a shared variable or something similar. The answer is that I don't want to do it yet |->. Eventually, there will be proper standard thread scheduling support wrapped around (depending on the build target) pthreads or a fixed process scheduler based on hardware drivers, and there will also be the standard modern-OS type of concurrency primitives (mutexes, semaphores, shared memory, even possibly abstract message passing and mailboxes). But that is a lot of work and right now the only blocking function I can forsee is (was) the damn reading of characters from stdin, which has been dealt with. So I should be good to go for most needs for a while at least....

Posted by Jon Taylor 2013-04-10

Log in to post a comment.