[erlang-questions] Port Driver. erl_drv_thread_join and ErlDrvTid reuse.

Rickard Green <>
Thu Oct 11 16:13:08 CEST 2012



On 10/11/2012 03:11 PM, Zhemzhitsky Sergey wrote:
> Hi Rickard,
>
>>> Are you calling driver_failure_atom() from your thread? That would explain this issue.
>
> Exactly. Could you explain a little bit more why it can cause this issue (I suppose it's due to it is not thread safe)?
>

Yes, it is because driver_failure_atom() is not thread safe. Apart from 
misc thread unsafe modifications of the port internal state, 
driver_failure_atom() can call the stop() callback which means that your 
thread will end up trying to join with itself.

Regards,
Rickard
-- 
Rickard Green, Erlang/OTP, Ericsson AB.



More information about the erlang-questions mailing list