diff options
author | Sverker Eriksson <[email protected]> | 2019-02-20 16:06:03 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-02-20 16:06:03 +0100 |
commit | 1937c8e3f7860ff3dfbeb6d25dd434fcd3102ba8 (patch) | |
tree | 22b78ac4084d91a1baa661e54e654dc285a3a9ed /erts/emulator/test/nif_SUITE_data | |
parent | 9197f6ea9af095eebbbf42e4ceca5ef762467276 (diff) | |
download | otp-1937c8e3f7860ff3dfbeb6d25dd434fcd3102ba8.tar.gz otp-1937c8e3f7860ff3dfbeb6d25dd434fcd3102ba8.tar.bz2 otp-1937c8e3f7860ff3dfbeb6d25dd434fcd3102ba8.zip |
erts: Add enif_compare_pids
as a macro wrappper around enif_compare
Diffstat (limited to 'erts/emulator/test/nif_SUITE_data')
-rw-r--r-- | erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index 4dbd22fa8c..0d5d900d31 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -3573,6 +3573,16 @@ static ERL_NIF_TERM is_pid_undefined_nif(ErlNifEnv* env, int argc, const ERL_NIF return make_bool(env, enif_is_pid_undefined(&pid)); } +static ERL_NIF_TERM compare_pids_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{ + ErlNifPid a, b; + + if (!get_pidbin(env, argv[0], &a) || !get_pidbin(env, argv[1], &b)) + return enif_make_badarg(env); + + return enif_make_int(env, enif_compare_pids(&a, &b)); +} + static ErlNifFunc nif_funcs[] = { {"lib_version", 0, lib_version}, @@ -3679,7 +3689,8 @@ static ErlNifFunc nif_funcs[] = {"get_local_pid_nif", 1, get_local_pid_nif}, {"make_pid_nif", 1, make_pid_nif}, {"set_pid_undefined_nif", 0, set_pid_undefined_nif}, - {"is_pid_undefined_nif", 1, is_pid_undefined_nif} + {"is_pid_undefined_nif", 1, is_pid_undefined_nif}, + {"compare_pids_nif", 2, compare_pids_nif} }; ERL_NIF_INIT(nif_SUITE,nif_funcs,load,NULL,upgrade,unload) |