Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[coop] Drop support for MONO_ENABLE_BLOCKING_TRANSITION env var #12270

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 0 additions & 40 deletions mono/utils/mono-threads-coop.c
Expand Up @@ -639,52 +639,12 @@ mono_threads_suspend_policy_name (MonoThreadsSuspendPolicy policy)
}
}

static gboolean
blocking_transition_getenv_compat (void)
{
static int inenv = -1;
if (G_UNLIKELY (inenv == -1))
inenv = g_hasenv ("MONO_ENABLE_BLOCKING_TRANSITION");
return inenv;
}

static gboolean
blocking_transition_from_policy (MonoThreadsSuspendPolicy p)
{
switch (p) {
case MONO_THREADS_SUSPEND_FULL_COOP:
case MONO_THREADS_SUSPEND_HYBRID:
return TRUE;
case MONO_THREADS_SUSPEND_FULL_PREEMPTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
}

gboolean
mono_threads_suspend_policy_is_blocking_transition_enabled (MonoThreadsSuspendPolicy p)
{
return blocking_transition_getenv_compat () ||
blocking_transition_from_policy (p);
}

gboolean
mono_threads_is_cooperative_suspension_enabled (void)
{
return (mono_threads_suspend_policy () == MONO_THREADS_SUSPEND_FULL_COOP);
}

gboolean
mono_threads_is_blocking_transition_enabled (void)
{
static int enabled = -1;
if (G_UNLIKELY (enabled == -1)) {
enabled = mono_threads_suspend_policy_is_blocking_transition_enabled (mono_threads_suspend_policy ());
}
return enabled == 1;
}

gboolean
mono_threads_is_hybrid_suspension_enabled (void)
{
Expand Down
21 changes: 19 additions & 2 deletions mono/utils/mono-threads-coop.h
Expand Up @@ -33,6 +33,20 @@ typedef enum {
MONO_THREADS_SUSPEND_HYBRID = 3,
} MonoThreadsSuspendPolicy;

static inline gboolean
mono_threads_suspend_policy_is_blocking_transition_enabled (MonoThreadsSuspendPolicy p)
{
switch (p) {
case MONO_THREADS_SUSPEND_FULL_COOP:
case MONO_THREADS_SUSPEND_HYBRID:
return TRUE;
case MONO_THREADS_SUSPEND_FULL_PREEMPTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
}

static inline gboolean
mono_threads_suspend_policy_are_safepoints_enabled (MonoThreadsSuspendPolicy p)
{
Expand Down Expand Up @@ -61,8 +75,11 @@ mono_threads_suspend_policy (void);
const char*
mono_threads_suspend_policy_name (MonoThreadsSuspendPolicy p);

gboolean
mono_threads_is_blocking_transition_enabled (void);
static inline gboolean
mono_threads_is_blocking_transition_enabled (void)
{
return mono_threads_suspend_policy_is_blocking_transition_enabled (mono_threads_suspend_policy ());
}

gboolean
mono_threads_is_cooperative_suspension_enabled (void);
Expand Down