mfichman / jogo

High(er) performance compiled programming language with clean, powerful syntax
MIT License
6 stars 1 forks source link

Adapt Io::Manager::poll for non-blocking #65

Closed mfichman closed 11 years ago

mfichman commented 11 years ago

Games usually run in a continual async loop. Currently, Io::Manager::poll blocks if there is any I/O to be done. Obviously, this would cause the renderer to stop displaying things. Instead, Io::Manager::poll should compare the number of "waiting" coroutines (i.e., waiting on input, timer, etc.) to the total number of task-coroutines. If they are equal (or less) then Io::Manager::poll should block to avoid unnecessary CPU usage. Otherwise, it should not block, so that CPU-intensive coroutines can keep running while other coroutines are waiting for I/O.

mfichman commented 11 years ago

Thus, rather than passing, e.g., INFINITE to GetQueuedCompletionStatus(), the Io::Manager would pass 0 if there are active task-coroutines.