Fix profiler/hook interaction.
This commit is contained in:
@@ -87,6 +87,34 @@ static ProfileState profile_state;
|
||||
/* Default sample interval in milliseconds. */
|
||||
#define LJ_PROFILE_INTERVAL_DEFAULT 10
|
||||
|
||||
/* -- Profiler/hook interaction ------------------------------------------- */
|
||||
|
||||
#if !LJ_PROFILE_SIGPROF
|
||||
void LJ_FASTCALL lj_profile_hook_enter(global_State *g)
|
||||
{
|
||||
ProfileState *ps = &profile_state;
|
||||
if (ps->g) {
|
||||
profile_lock(ps);
|
||||
hook_enter(g);
|
||||
profile_unlock(ps);
|
||||
} else {
|
||||
hook_enter(g);
|
||||
}
|
||||
}
|
||||
|
||||
void LJ_FASTCALL lj_profile_hook_leave(global_State *g)
|
||||
{
|
||||
ProfileState *ps = &profile_state;
|
||||
if (ps->g) {
|
||||
profile_lock(ps);
|
||||
hook_leave(g);
|
||||
profile_unlock(ps);
|
||||
} else {
|
||||
hook_leave(g);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -- Profile callbacks --------------------------------------------------- */
|
||||
|
||||
/* Callback from profile hook (HOOK_PROFILE already cleared). */
|
||||
|
||||
Reference in New Issue
Block a user