Send - buffer overrun

Ulf Wiger (AL/EAB) <>
Wed Apr 5 08:54:43 CEST 2006


 
Claes Wikstrom wrote:
> 
> Port ! {self(), {command, Data}}
> 
> or any of the equivalents will be automatically suspended 
> until the port is marked as "not busy" by the driver.
[...]
> 
> The downside of this, is that it's not possible to write an 
> erlang program that detects that the reader isn't reading 
> fast enough. (At least not easily).

Not that I've used it myself, but the BIFs

erlang:send_nosuspend(Dest, Msg), and
erlang:send(Dest, Msg, [nosuspend)

are supposed to deal with this situation, by returning 'false'
(and not sending the message) if the sender would have been
suspended. The man page says "use with extreme care!".

BR,
Ulf W



More information about the erlang-questions mailing list