Fri Nov 19 18:30:01 CET 2010
While I have read the erl_nif documentation (that says "Avoid doing lengthy
work in NIF calls as that may degrade the responsiveness of the VM. NIFs are
called directly by the same scheduler thread that executed the calling
Erlang code. The calling scheduler will thus be blocked from doing any other
work until the NIF returns.") -- I'm trying to do keyboard input in a NIF.
Is this absolutely a bad idea, or is there a way to make it work? I've found
that simple example programs, running ~2 processes, one of them blocking on
a getch() in a NIF works fine -- unfortunately trying to integrate that
blocking NIF call into a larger program with upwards of 10 processes seems
to not work at all, regardless of how many async threads I use.
Can anyone give me some insight into this? Preferably something other than
'don't use NIFs to do that' -- I will eventually give up if it's just not
workable, but I'm not ready to do that yet! :-)
More information about the erlang-questions