[erlang-questions] enif_send from a thread after NIF returns

Joel Reymont joelr1@REDACTED
Tue Oct 26 15:12:48 CEST 2010


On Oct 26, 2010, at 2:09 PM, Rapsey wrote:

> Where in the documentation does it say that? I launch my socket accept thread in load.

man erl_driver

/erl_drv_thread_create

---
       The driver creating the thread has the  respon-
       sibility  of joining the thread, via erl_drv_thread_join() , before the
       driver is unloaded. It is not possible to  create  "detached"  threads,
       i.e., threads that don't need to be joined.

   Warning:
       All  created  threads  need  to  be  joined  by the driver before it is
       unloaded. If the driver fails to join all threads created before it  is
       unloaded,  the  runtime  system will most likely crash when the code of
       the driver is unloaded.
---

In the context of a NIF, "driver unloaded" seems to be "NIF exits". The VM consistently crashes when I skip the join after creating threads. 

---
http://twitter.com/wagerlabs



More information about the erlang-questions mailing list