diff options
author | John Högberg <[email protected]> | 2017-11-07 09:31:24 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2017-11-30 15:26:26 +0100 |
commit | 5036bf7d5006a6f1a4294b4a3b1f4120d39113ac (patch) | |
tree | d08757379bef5c9e5607c1da95909e4511d51cc9 /erts/emulator/test/nif_SUITE_data | |
parent | f5e99a55d4d62074d2bd2e5a58c578a31bc214c8 (diff) | |
download | otp-5036bf7d5006a6f1a4294b4a3b1f4120d39113ac.tar.gz otp-5036bf7d5006a6f1a4294b4a3b1f4120d39113ac.tar.bz2 otp-5036bf7d5006a6f1a4294b4a3b1f4120d39113ac.zip |
Add enif_ioq_peek_head
This introduces a way to retrieve erlang terms from NIF IO queues
without having to resort to copying.
OTP-14797
Diffstat (limited to 'erts/emulator/test/nif_SUITE_data')
-rw-r--r-- | erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index 79560a38aa..fa9ae1015c 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -3403,6 +3403,15 @@ static ERL_NIF_TERM ioq(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) return enif_make_badarg(env); else return enif_make_atom(env, "true"); + } else if (enif_is_identical(argv[0], enif_make_atom(env, "peek_head"))) { + ERL_NIF_TERM head_term; + + if(enif_ioq_peek_head(env, ioq->q, NULL, &head_term)) { + return enif_make_tuple2(env, + enif_make_atom(env, "true"), head_term); + } + + return enif_make_atom(env, "false"); } else if (enif_is_identical(argv[0], enif_make_atom(env, "peek"))) { int iovlen, num, i, off = 0; SysIOVec *iov = enif_ioq_peek(ioq->q, &iovlen); |