[erlang-questions] On Per-module process registration

Ulf Wiger <>
Sat Feb 13 15:42:22 CET 2010


Anthony Shipman wrote:
> I have implemented my own kinds of registry. What I don't have is the
> ability to atomically spawn and register a process. Perhaps just
> adding the ability to spawn a process in a paused state and then
> unpause it later would solve that problem.

Like this?


-module(hib).
-export([sp/0,init/0]).

sp() ->
     spawn(fun() ->
                   erlang:hibernate(?MODULE,init,[])
           end).

init() ->
     io:fwrite("ho!~n", []).




1> P=hib:sp().
<0.58.0>
2> timer:sleep(3000), P ! hi.
ho!
hi


BR,
Ulf W

-- 
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list