sends don't block, right?
Wed Feb 25 04:48:21 CET 2004
Ok, colo(u)r me stupid now (borrowed phrase, sorry!):
! doesn't block, right?
If I do something foolish like this:
Pid = spawn(fun() -> receive foo -> ok end),
Pid ! bar,
io:format("still going, just like the bunny~n", ),
will the parent ever stop because the child's message buffer is full?
Basically, I'm asking if Erlang will let the parent in this case run
the VM out of memory before making the parent freeze. Clearly one should
never write this code, but I'm trying to setup an async-send for my
serial driver that will "never" block the caller, as apposed to the
blocking send which makes sure the data was delivered to the endpoint
The only reason I'm concerned here is the caller could lock up if it
gets blocked and hardware or software flow control breaks down due to
With most serial protocols I wouldn't see the need to buffer more than
a few hundred KB of data, and the port driver already has buffers deep
enough to handle that, so in theory, port_command/2 should never block.
I just want to keep from blocking up the application, if the application
C Code Run.
Run, Code, RUN!
More information about the erlang-questions