aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-06-08 14:58:33 +0200
committerRickard Green <[email protected]>2016-06-08 15:20:04 +0200
commit77192f7f32d4bbe293a6e8cb9da79b8a6dd6b181 (patch)
tree2e54e27bb98ad94f46ca265404755862fdd395bf /erts/emulator/beam/erl_nif.c
parent049611f98d67f11f8e06fe0b0fc50eb8ca1925d8 (diff)
downloadotp-77192f7f32d4bbe293a6e8cb9da79b8a6dd6b181.tar.gz
otp-77192f7f32d4bbe293a6e8cb9da79b8a6dd6b181.tar.bz2
otp-77192f7f32d4bbe293a6e8cb9da79b8a6dd6b181.zip
Replace enif_is_on_dirty_scheduler() with enif_thread_type()
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 4fd82bad10..039f97ef43 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -2658,18 +2658,21 @@ done:
}
int
-enif_is_on_dirty_scheduler(ErlNifEnv* env)
+enif_thread_type(void)
{
- int scheduler;
- Process *c_p;
+ ErtsSchedulerData *esdp = erts_get_scheduler_data();
- execution_state(env, &c_p, &scheduler);
+ if (!esdp)
+ return ERL_NIF_THR_UNDEFINED;
+
+ if (!ERTS_SCHEDULER_IS_DIRTY(esdp))
+ return ERL_NIF_THR_NORMAL_SCHEDULER;
- if (!c_p || !scheduler)
- erts_exit(ERTS_ABORT_EXIT, "enif_is_on_dirty_scheduler: "
- "Invalid env");
+ if (ERTS_SCHEDULER_IS_DIRTY_CPU(esdp))
+ return ERL_NIF_THR_DIRTY_CPU_SCHEDULER;
- return scheduler < 0;
+ ASSERT(ERTS_SCHEDULER_IS_DIRTY_IO(esdp));
+ return ERL_NIF_THR_DIRTY_IO_SCHEDULER;
}
/* Maps */