Hello Rickard,
Thanks a lot for clarification.
I'm doing erl_drv_thread_join() only once and only for threads created by erl_drv_thread_create().
The error only happens from time to time in the following scenario:
1. Erlang process, I send messages from the ddriver to, dies for some reason
2. Driver callback process_exit fires.
3. From the driver thread I'm trying to send the final message to the dead erlang process with driver_send_term
4. As the erlang process is dead, driver_send_term fails
5. As driver_send_term fails I'm doing driver_failure_atom to kill linked process.
Here two things happen:
6.1 (*stop)(ErlDrvData drv_data) executes as linked process has been killed by driver_failure_atom
6.2 Thread, started in the driver, exists
When (*stop)(ErlDrvData drv_data) executes erl_drv_thread_join is called for all the threads started in the driver.
So something wrong happens that leads to tid reuse.
Best Regards,
Sergey
_______________________________________________________
CONFIDENTIALITY NOTICE: This email and any files attached to it may be conf idential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.