[erlang-questions] Is driver_mk_atom() thread safe?
Fri Sep 25 20:16:15 CEST 2009
I believe it is NOT thread-safe unless explicitly said to be. From the docs:
"Most functions in this API are not thread-safe, i.e., they may not be
called from an arbitrary thread. Function that are not documented as
thread-safe may only be called from driver call-backs or function
calls descending from a driver call-back call. Note that driver
call-backs may be called from different threads. This, however, is not
a problem for any functions in this API, since the emulator have
control over these threads."
On Fri, Sep 25, 2009 at 11:32 AM, Chris Newcombe
> Hi BEAM / OTP team,
> I have a driver that uses private thread-pools. I know there are
> heavy restrictions on calling most erl_driver functions from private
> threads, and for some functions the documentation now helpfully says
> whether they are thread-safe, or only thread-safe when using the SMP
> emulator etc.
> The documentation for driver_mk_atom() doesn't mention thread-safety
> (see below).
> Please could it be documented one way or the other? (If it's not
> thread-safe then that's fine, I'll just have to work around it. But
> it would be great to know.)
> Many thanks,
> From the erl_driver man-page:
> ErlDrvTermData driver_mk_atom(char* string)
> This function returns an atom given a name string. The atom is
> created and won't change, so the return value may be saved and reused,
> which is faster than looking up the atom several times.
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions