diff options
author | Sverker Eriksson <[email protected]> | 2019-02-20 16:04:58 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-02-20 16:04:58 +0100 |
commit | 9197f6ea9af095eebbbf42e4ceca5ef762467276 (patch) | |
tree | 56e088a1c6e3ddeea421525e8eb4d0db044535e8 /erts/emulator/beam/erl_nif.c | |
parent | 1468c77c81de0f7c44e44d8c4a430ff0ee809736 (diff) | |
download | otp-9197f6ea9af095eebbbf42e4ceca5ef762467276.tar.gz otp-9197f6ea9af095eebbbf42e4ceca5ef762467276.tar.bz2 otp-9197f6ea9af095eebbbf42e4ceca5ef762467276.zip |
erts: Add enif_set_pid_undefined & enif_is_pid_undefined
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 82645d4091..0efef37802 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1083,6 +1083,17 @@ int enif_get_local_pid(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifPid* pid) return 0; } +void enif_set_pid_undefined(ErlNifPid* pid) +{ + pid->pid = am_undefined; +} + +int enif_is_pid_undefined(const ErlNifPid* pid) +{ + ASSERT(pid->pid == am_undefined || is_internal_pid(pid->pid)); + return pid->pid == am_undefined; +} + int enif_get_local_port(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifPort* port) { if (is_internal_port(term)) { @@ -3336,6 +3347,9 @@ int enif_monitor_process(ErlNifEnv* env, void* obj, const ErlNifPid* target_pid, } ASSERT(rsrc->type->down); + if (target_pid->pid == am_undefined) + return 1; + ref = erts_make_ref_in_buffer(tmp); mdp = erts_monitor_create(ERTS_MON_TYPE_RESOURCE, ref, |