3 ms·
> Is that common in elixir/erlang, for libraries to provide blocking utilities? It's very common to have blocking API as that's convenient and better hides the
by masklinn 10y ago
> Is that common in elixir/erlang, for libraries to provide blocking utilities?
It's very common to have blocking API as that's convenient and better hides the implementation details of the API.
Note that the blocking is completely local, it'll simply yield back to the scheduler and some other process will get to run (and BEAM is preemptive so after a number of operations — reductions in BEAM parlance — it's going to deschedule the current process and let something else run even without IO calls).
And of course you can trivially "unblock" the call by creating a wrapper process for that call.