[erlang-questions] NFI's and running multiple VM's

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Mar 13 14:43:33 CET 2015

On Thu, Mar 12, 2015 at 11:45 PM, Leandro Ostera <me@REDACTED> wrote:

> I was trying to use a quite old erlang wrapper around libspotify
> <https://github.com/arjan/espotify>, which seems to be defining a bunch
> of NIFs, to make an audio streaming server that would keep N web-based
> clients playing the same audio at (give or take milliseconds) the same
> time. The problem is that according to one of the source files
> <https://github.com/arjan/espotify/blob/master/src/espotify_api.erl#L73-L84>,
> it'd only be able to have one open Spotify session per VM, which of course
> didn't sound too exciting.

The library may not be thread-safe. That is, it assumes a single thread for
access and it stores session information in global variables inside the
library itself. You may want to check if there is a newer version of the
library without these limitations.

NIFs do support proper multithreading and local context, but the library
needs to support it as well. The term you are looking for w.r.t the context
are 'resources':


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150313/df44b075/attachment.htm>

More information about the erlang-questions mailing list