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

Joel Reymont joelr1@REDACTED
Tue Oct 26 15:29:44 CEST 2010

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

> Does unload/reload/upgrade get called? I have printf in those so that I know what's going on.

I'm sure it does, although I'm not using it. Thanks for the tip, though. I now understand that the unload "callback" corresponds to driver unload and that's where threads must be joined. 

I'm trying to implement asynchronous fsync, though, so I spawn a thread for each fsync. Joining all those threads on unload in a long-running server would require me to keep a -huge- stack of thread ids, one per fsync call. I realize that it's probably a bad idea to launch a thread for each fsync but I'm just experimenting.

How do you work around this in your network server? Do you use a thread pool?

	Thanks, Joel


More information about the erlang-questions mailing list