Skip to content

Commit

Permalink
Remove trailing _async suffix for run_on_thread functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Dec 18, 2023
1 parent dbe9193 commit f6a38e6
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 62 deletions.
2 changes: 1 addition & 1 deletion bindings/gumjs/gumquickprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ GUMJS_DEFINE_FUNCTION (gumjs_process_run_on_thread)

stalker = gum_stalker_new ();

success = gum_stalker_run_on_thread_async (stalker, thread_id,
success = gum_stalker_run_on_thread (stalker, thread_id,
gum_js_process_run_cb, &sync_ctx);
_gum_quick_scope_resume (&scope);

Expand Down
2 changes: 1 addition & 1 deletion bindings/gumjs/gumv8process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ GUMJS_DEFINE_FUNCTION (gumjs_process_run_on_thread)
sync_ctx.context = context;
sync_ctx.user_func = Local<Function>::New (isolate, user_func);

success = gum_stalker_run_on_thread_async (stalker, thread_id,
success = gum_stalker_run_on_thread (stalker, thread_id,
gum_js_process_run_cb, &sync_ctx);
}

Expand Down
20 changes: 10 additions & 10 deletions gum/backend-arm/gumstalker-arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ static gboolean gum_is_exclusive_store_insn (const cs_insn * insn);
static guint gum_count_bits_set (guint16 value);
static guint gum_count_trailing_zeros (guint16 value);

static void gum_stalker_do_run_on_thread_async (GumThreadId thread_id,
static void gum_stalker_do_run_on_thread (GumThreadId thread_id,
GumCpuContext * cpu_context, gpointer user_data);

G_DEFINE_TYPE (GumStalker, gum_stalker, G_TYPE_OBJECT)
Expand Down Expand Up @@ -6221,23 +6221,23 @@ gum_stalker_is_run_on_thread_supported (void)
}

gboolean
gum_stalker_run_on_thread_async (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
gum_stalker_run_on_thread (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
{
GumStalkerRunOnThreadCtx ctx;
ctx.stalker = self;
ctx.func = func;
ctx.user_data = user_data;
return gum_process_modify_thread (thread_id,
gum_stalker_do_run_on_thread_async, &ctx, GUM_MODIFY_THREAD_FLAGS_NONE);
return gum_process_modify_thread (thread_id, gum_stalker_do_run_on_thread,
&ctx, GUM_MODIFY_THREAD_FLAGS_NONE);
}

static void
gum_stalker_do_run_on_thread_async (GumThreadId thread_id,
GumCpuContext * cpu_context,
gpointer user_data)
gum_stalker_do_run_on_thread (GumThreadId thread_id,
GumCpuContext * cpu_context,
gpointer user_data)
{
GumStalkerRunOnThreadCtx * run_ctx = (GumStalkerRunOnThreadCtx *) user_data;
GumStalker * self = run_ctx->stalker;
Expand Down
20 changes: 10 additions & 10 deletions gum/backend-arm64/gumstalker-arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ static gpointer gum_find_thread_exit_implementation (void);

static gboolean gum_is_bl_imm (guint32 insn) G_GNUC_UNUSED;

static void gum_stalker_do_run_on_thread_async (GumThreadId thread_id,
static void gum_stalker_do_run_on_thread (GumThreadId thread_id,
GumCpuContext * cpu_context, gpointer user_data);

G_DEFINE_TYPE (GumStalker, gum_stalker, G_TYPE_OBJECT)
Expand Down Expand Up @@ -5905,23 +5905,23 @@ gum_stalker_is_run_on_thread_supported (void)
}

gboolean
gum_stalker_run_on_thread_async (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
gum_stalker_run_on_thread (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
{
GumStalkerRunOnThreadCtx ctx;
ctx.stalker = self;
ctx.func = func;
ctx.user_data = user_data;
return gum_process_modify_thread (thread_id,
gum_stalker_do_run_on_thread_async, &ctx, GUM_MODIFY_THREAD_FLAGS_NONE);
return gum_process_modify_thread (thread_id, gum_stalker_do_run_on_thread,
&ctx, GUM_MODIFY_THREAD_FLAGS_NONE);
}

static void
gum_stalker_do_run_on_thread_async (GumThreadId thread_id,
GumCpuContext * cpu_context,
gpointer user_data)
gum_stalker_do_run_on_thread (GumThreadId thread_id,
GumCpuContext * cpu_context,
gpointer user_data)
{
GumStalkerRunOnThreadCtx * run_ctx = (GumStalkerRunOnThreadCtx *) user_data;
GumStalker * self = run_ctx->stalker;
Expand Down
8 changes: 4 additions & 4 deletions gum/backend-mips/gumstalker-mips.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ gum_stalker_is_run_on_thread_supported (void)
}

gboolean
gum_stalker_run_on_thread_async (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
gum_stalker_run_on_thread (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
{
return FALSE;
}
Expand Down
20 changes: 10 additions & 10 deletions gum/backend-x86/gumstalker-x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ static GumInterceptor * gum_exec_ctx_interceptor = NULL;
# endif
#endif

static void gum_stalker_do_run_on_thread_async (GumThreadId thread_id,
static void gum_stalker_do_run_on_thread (GumThreadId thread_id,
GumCpuContext * cpu_context, gpointer user_data);

gboolean
Expand Down Expand Up @@ -6661,23 +6661,23 @@ gum_stalker_is_run_on_thread_supported (void)
}

gboolean
gum_stalker_run_on_thread_async (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
gum_stalker_run_on_thread (GumStalker * self,
GumThreadId thread_id,
GumStalkerRunOnThreadFunc func,
gpointer user_data)
{
GumStalkerRunOnThreadCtx ctx;
ctx.stalker = self;
ctx.func = func;
ctx.user_data = user_data;
return gum_process_modify_thread (thread_id,
gum_stalker_do_run_on_thread_async, &ctx, GUM_MODIFY_THREAD_FLAGS_NONE);
return gum_process_modify_thread (thread_id, gum_stalker_do_run_on_thread,
&ctx, GUM_MODIFY_THREAD_FLAGS_NONE);
}

static void
gum_stalker_do_run_on_thread_async (GumThreadId thread_id,
GumCpuContext * cpu_context,
gpointer user_data)
gum_stalker_do_run_on_thread (GumThreadId thread_id,
GumCpuContext * cpu_context,
gpointer user_data)
{
GumStalkerRunOnThreadCtx * run_ctx = (GumStalkerRunOnThreadCtx *) user_data;
GumStalker * self = run_ctx->stalker;
Expand Down
4 changes: 2 additions & 2 deletions gum/gumstalker.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ gum_stalker_run_on_thread_sync (GumStalker * self,

if (gum_process_get_current_thread_id () == thread_id)
{
return gum_stalker_run_on_thread_async (self, thread_id, func, user_data);
return gum_stalker_run_on_thread (self, thread_id, func, user_data);
}
else
{
Expand All @@ -450,7 +450,7 @@ gum_stalker_run_on_thread_sync (GumStalker * self,
ctx.user_data = user_data;

g_mutex_lock (&ctx.mutex);
if (!gum_stalker_run_on_thread_async (self, thread_id,
if (!gum_stalker_run_on_thread (self, thread_id,
gum_stalker_do_run_on_thread_sync, &ctx))
{
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion gum/gumstalker.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ GUM_API void gum_stalker_observer_switch_callback (

GUM_API gboolean gum_stalker_is_run_on_thread_supported (void);

GUM_API gboolean gum_stalker_run_on_thread_async (GumStalker * self,
GUM_API gboolean gum_stalker_run_on_thread (GumStalker * self,
GumThreadId thread_id, GumStalkerRunOnThreadFunc func, gpointer user_data);

GUM_API gboolean gum_stalker_run_on_thread_sync (GumStalker * self,
Expand Down
13 changes: 6 additions & 7 deletions tests/core/arch-arm/stalker-arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ TESTLIST_BEGIN (stalker)
#endif
TESTGROUP_BEGIN ("RunOnThread")
TESTENTRY (run_on_thread_support)
TESTENTRY (run_on_thread_current_async)
TESTENTRY (run_on_thread_current)
TESTENTRY (run_on_thread_current_sync)
TESTENTRY (run_on_thread_other_async)
TESTENTRY (run_on_thread_other)
TESTENTRY (run_on_thread_other_sync)
TESTGROUP_END ()
TESTLIST_END ()
Expand Down Expand Up @@ -3809,13 +3809,13 @@ TESTCASE (run_on_thread_support)
g_assert_true (supported);
}

TESTCASE (run_on_thread_current_async)
TESTCASE (run_on_thread_current)
{
GumThreadId thread_id = gum_process_get_current_thread_id ();
RunOnThreadCtx ctx;
gboolean success;

success = gum_stalker_run_on_thread_async (fixture->stalker, thread_id,
success = gum_stalker_run_on_thread (fixture->stalker, thread_id,
run_on_thread, &ctx);

#if defined (HAVE_ANDROID)
Expand Down Expand Up @@ -3859,7 +3859,7 @@ run_on_thread (const GumCpuContext * cpu_context, gpointer user_data)
ctx->thread_id = gum_process_get_current_thread_id ();
}

TESTCASE (run_on_thread_other_async)
TESTCASE (run_on_thread_other)
{
GumThreadId this_id, other_id;
volatile gboolean done = FALSE;
Expand All @@ -3869,8 +3869,7 @@ TESTCASE (run_on_thread_other_async)
this_id = gum_process_get_current_thread_id ();

thread = create_sleeping_dummy_thread_sync (&done, &other_id);
gum_stalker_run_on_thread_async (fixture->stalker, other_id, run_on_thread,
&ctx);
gum_stalker_run_on_thread (fixture->stalker, other_id, run_on_thread, &ctx);

done = TRUE;
g_thread_join (thread);
Expand Down
13 changes: 6 additions & 7 deletions tests/core/arch-arm64/stalker-arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ TESTLIST_BEGIN (stalker)
#endif
TESTGROUP_BEGIN ("RunOnThread")
TESTENTRY (run_on_thread_support)
TESTENTRY (run_on_thread_current_async)
TESTENTRY (run_on_thread_current)
TESTENTRY (run_on_thread_current_sync)
TESTENTRY (run_on_thread_other_async)
TESTENTRY (run_on_thread_other)
TESTENTRY (run_on_thread_other_sync)
TESTGROUP_END ()
TESTLIST_END ()
Expand Down Expand Up @@ -2427,13 +2427,13 @@ TESTCASE (run_on_thread_support)
g_assert_true (supported);
}

TESTCASE (run_on_thread_current_async)
TESTCASE (run_on_thread_current)
{
GumThreadId thread_id = gum_process_get_current_thread_id ();
RunOnThreadCtx ctx;
gboolean success;

success = gum_stalker_run_on_thread_async (fixture->stalker, thread_id,
success = gum_stalker_run_on_thread (fixture->stalker, thread_id,
run_on_thread, &ctx);

#if defined (HAVE_ANDROID)
Expand Down Expand Up @@ -2477,7 +2477,7 @@ run_on_thread (const GumCpuContext * cpu_context, gpointer user_data)
ctx->thread_id = gum_process_get_current_thread_id ();
}

TESTCASE (run_on_thread_other_async)
TESTCASE (run_on_thread_other)
{
GumThreadId this_id, other_id;
volatile gboolean done = FALSE;
Expand All @@ -2487,8 +2487,7 @@ TESTCASE (run_on_thread_other_async)
this_id = gum_process_get_current_thread_id ();

thread = create_sleeping_dummy_thread_sync (&done, &other_id);
gum_stalker_run_on_thread_async (fixture->stalker, other_id, run_on_thread,
&ctx);
gum_stalker_run_on_thread (fixture->stalker, other_id, run_on_thread, &ctx);

done = TRUE;
g_thread_join (thread);
Expand Down
13 changes: 6 additions & 7 deletions tests/core/arch-x86/stalker-x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ TESTLIST_BEGIN (stalker)
#endif
TESTGROUP_BEGIN ("RunOnThread")
TESTENTRY (run_on_thread_support)
TESTENTRY (run_on_thread_current_async)
TESTENTRY (run_on_thread_current)
TESTENTRY (run_on_thread_current_sync)
TESTENTRY (run_on_thread_other_async)
TESTENTRY (run_on_thread_other)
TESTENTRY (run_on_thread_other_sync)
TESTGROUP_END ()
TESTLIST_END ()
Expand Down Expand Up @@ -3518,13 +3518,13 @@ TESTCASE (run_on_thread_support)
g_assert_true (supported);
}

TESTCASE (run_on_thread_current_async)
TESTCASE (run_on_thread_current)
{
GumThreadId thread_id = gum_process_get_current_thread_id ();
RunOnThreadCtx ctx;
gboolean success;

success = gum_stalker_run_on_thread_async (fixture->stalker, thread_id,
success = gum_stalker_run_on_thread (fixture->stalker, thread_id,
run_on_thread, &ctx);

#if defined (HAVE_ANDROID)
Expand Down Expand Up @@ -3568,7 +3568,7 @@ run_on_thread (const GumCpuContext * cpu_context, gpointer user_data)
ctx->thread_id = gum_process_get_current_thread_id ();
}

TESTCASE (run_on_thread_other_async)
TESTCASE (run_on_thread_other)
{
GumThreadId this_id, other_id;
volatile gboolean done = FALSE;
Expand All @@ -3578,8 +3578,7 @@ TESTCASE (run_on_thread_other_async)
this_id = gum_process_get_current_thread_id ();

thread = create_sleeping_dummy_thread_sync (&done, &other_id);
gum_stalker_run_on_thread_async (fixture->stalker, other_id, run_on_thread,
&ctx);
gum_stalker_run_on_thread (fixture->stalker, other_id, run_on_thread, &ctx);

done = TRUE;
g_thread_join (thread);
Expand Down
4 changes: 2 additions & 2 deletions tests/gumjs/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ TESTLIST_BEGIN (script)

TESTGROUP_BEGIN ("RunOnThread")
TESTENTRY (process_can_run_on_thread_sync)
TESTENTRY (process_can_run_on_thread_async)
TESTENTRY (process_can_run_on_thread)
TESTGROUP_END ()

TESTGROUP_BEGIN ("Module")
Expand Down Expand Up @@ -5338,7 +5338,7 @@ TESTCASE (process_can_run_on_thread_sync)
g_thread_join (thread);
}

TESTCASE (process_can_run_on_thread_async)
TESTCASE (process_can_run_on_thread)
{
GThread * thread;
GumThreadId thread_id;
Expand Down

0 comments on commit f6a38e6

Please sign in to comment.