首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

whereis 跟 is_pid 连用

2012-12-20 
whereis 和 is_pid 连用Eshell V5.7.4 ?(abort with ^G)1 Pself().0.33.02 is_pid(P).true3 registe

whereis 和 is_pid 连用

Eshell V5.7.4 ?(abort with ^G)

1> P=self().

<0.33.0>

2> is_pid(P).

true

3> register(p,P)

3> .

true

4> is_pid(p). ??

false

5> whereis(p)

5> .

<0.33.0>

6> whereis(p1)

6> .

undefined

7> is_pid(whereis(p1)).

false

8> is_pid(whereis(p)).?

true

?

gen.erl 片段代码

?

call(Name, Label, Request, Timeout)

??when is_atom(Name), Timeout =:= infinity;

?? ? ? is_atom(Name), is_integer(Timeout), Timeout >= 0 ->

?? ?case whereis(Name) of

?? ? ? ?Pid when is_pid(Pid) ->

?? ? ? ? ? ?do_call(Pid, Label, Request, Timeout);

?? ? ? ?undefined ->

?? ? ? ? ? ?exit(noproc)

?? ?end;

热点排行