driver_send_term and receiver arg, expression to build pid

João Henrique Freitas joaohf@REDACTED
Fri Oct 15 21:14:02 CEST 2010


Hi,

In my free time I start to develop a driver to posix message queue for
erlang (http://github.com/joaohf/emq_posix/).

In the overall design, every mq can be used like a general file
description. I use this behavior and lets the erts select when are
some data in the
 fd to be read.

When the data is read I need to know what is the callback processes
(inside erlang VM) to send using the function:

driver_send_term(ErlDrvPort port, ErlDrvTermData receiver,
ErlDrvTermData* term, int n)

This blog http://dudefrommangalore.blogspot.com/2009_03_01_archive.html
(in my code http://github.com/joaohf/emq_posix/blob/master/c_src/emq_posix.c#L628),
 tell me to use a expression to 'receiver' argument.

Works but I want to know if is right.

Thanks

PS:

#define MAKE_CALLBACK_PID(x) ((ErlDrvTermData)( (( (*x).serial << 15 |
(*x).num)) << 4 | (0x0 << 2 | 0x3)) );
-- 
-----------------------------------------------------------
João Henrique Freitas - joaohf_at_gmail.com
Campinas-SP-Brasil
BSD051283
LPI 1
http://www.joaohfreitas.eti.br


More information about the erlang-questions mailing list