is 您所在的位置:网站首页 判断进程是否存活 is

is

2024-06-30 18:28| 来源: 网络整理| 查看: 265

erlang:is_process_alive/1

检测进程是否存活

用法:

is_process_alive(Pid) -> boolean()

检测进程(必须是本地节点的进程)是否还存活(尚未关掉或已经被关掉的情况),如果是,则返回 true,否则返回 false。

Pid = self(), erlang:is_process_alive(Pid).

跨节点的进程,可以调用 rpc:call/4 来检测:

IsProcessAlive = fun(Pid) -> case is_pid(Pid) of true -> case rpc:call(node(Pid), erlang, is_process_alive, [Pid]) of true -> true; _ -> false end; _ -> false end end, Pid = self(), IsProcessAlive(Pid).


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有