[erlang-questions] Re: register BIF
Scott Lystig Fritchie
fritchie@REDACTED
Tue Mar 15 23:10:23 CET 2011
Wes James <comptekki@REDACTED> wrote:
wj> register(timer2, timer2:timeout(0,0)) and it worked. The first
wj> timer2 is the module name. I guess it wants the module name to
wj> register, not just any atom.
Wes, that's incorrect: register/2's first arg can be any atom. But you
can't register the same name twice ... even if it's the same process
that is trying the second time.
1> code:which(file).
"/usr/local/erlang/R14B01.64bit/lib/erlang/lib/kernel-2.14.2/ebin/file.beam"
2> code:which(asdlkfklasdfljkasdfjlkasdf).
non_existing
3> self().
<0.32.0>
4> register(asdlkfklasdfljkasdfjlkasdf, self()).
true
5> self().
<0.32.0>
6> register(asdlkfklasdfljkasdfjlkasdf, self()).
** exception error: bad argument
in function register/2
called as register(asdlkfklasdfljkasdfjlkasdf,<0.32.0>)
-Scott
More information about the erlang-questions
mailing list