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

Rapsey rapsey@REDACTED
Tue Oct 26 15:37:46 CEST 2010


On Tue, Oct 26, 2010 at 3:29 PM, Joel Reymont <joelr1@REDACTED> wrote:

>
> 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?
>

I don't use fsync anywhere :)
I have only one accept thread and sockets are non-blocking.


Sergej


More information about the erlang-questions mailing list