[erlang-questions] knowing if messages are available with 'ei'

Mats Cronqvist <>
Fri Mar 23 11:32:34 CET 2007


Samuel Hornus wrote:
> Hello,
> Please pardon my ignorance as I'm new to Erlang.
> I am implementing a C-node that send and receive messages to erlang
> processes. I'm using the 'ei' library.
> I'd like to know if there is a way to check wether a message has
> arrived or not ?
> [...]
> So, is there a nicer solution ? or a way to avoid checking for new messages ?

   you can call select() on the fd you get from ei_connect(). that's what i (or 
rather, glib) do in gtknode.

> Also, is there a way to do that in Erlang (maybe with 'after 0' statement in a
> receive expression, but I'm not sure).

1> process_info(self(),message_queue_len).
{message_queue_len,0}

   mats

p.s. is your application described anywhere? sounds interesting.



More information about the erlang-questions mailing list