Higher order receieve anybody

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Tue Feb 24 15:59:46 CET 2004


From: "Tony Rogvall" <tony@REDACTED>
> 
> One idea (tested and implemented) is to use a primitive 
> erlang:signal(Pid,Sig, Info) to send
> a primitive form of messages.  For example message passing could be 
> implemented as
> erlang:signal(Pid, 'MESSAGE', Message). In Multi Pro Erlang we did the 
> signal dispatcher in C code.
> In retrospect we should have implemented a signal dispatcher / 
> signal_handler in Erlang. This way
> all signals (including messages) would be processed by Erlang code. 
> Then one could implement
> the link semantics and message reception etc in Erlang code!
> The signal handler should be called in the context of the receiving 
> process with some kind of
> interrupt semantics (when it comes to receive).
> 
> 
> -module(signal_handler).
> -export([handle_signal/3]).
> 
> handle_signal(From, 'MESSAGE', Message) ->
> erlang:queue_message(Message);
> handle_signal(From, 'LINK', _) ->
>           erlang:add_link(From);
> ...

Super cool! 

/Vlad



More information about the erlang-questions mailing list