Erlang port driver question
Tue Mar 1 10:42:26 CET 2005
I am developing an Erlang Port driver. That will receive/send data from
There's one C function, which will start receiving some data. For that, I
need to pass a buffer pointer and it's length, like below.
dataReceive(void *buffer, unsigned bufsize)
This function is asynchronous.
There's a data receiving queue, which will receive events from that device.
Once the data is received, it will put an Acknowledgement event to that
queue. I have to use the initial buffer given to dataReceive function to
receive that data in my program.
My question is, how can I keep a track of the *buffer given to dataReceive.
There can be many Erlang Processes start dataReceive on many devices,
through one Port Driver. How can I keep track of the *buffer variable? I
prefer not to keep a Map of those buffers in the C side.
Can a dummy buffer create on Erlang side, call the dataReceive, don't free
that buffer in C Port side, receive data to that and finally arrive on the
Please advice me!
More information about the erlang-questions