Skip to content

Commit

Permalink
Style corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Zuckerbraun authored and Simon Zuckerbraun committed Jul 12, 2024
1 parent af1f9ce commit 5a9e7b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion bindings/gumjs/gumquickcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2735,7 +2735,8 @@ GUMJS_DEFINE_FUNCTION (gumjs_wait_for_event)

g_mutex_lock (&self->event_mutex);

while (self->event_count == thread_data->event_count_last_seen && self->event_source_available)
while (self->event_count == thread_data->event_count_last_seen
&& self->event_source_available)
{
if (called_from_js_thread)
{
Expand Down
6 changes: 4 additions & 2 deletions bindings/gumjs/gumv8core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,8 @@ GUMJS_DEFINE_FUNCTION (gumjs_wait_for_event)

g_mutex_lock (&core->event_mutex);

while (core->event_count == thread_data->event_count_last_seen && core->event_source_available)
while (core->event_count == thread_data->event_count_last_seen
&& core->event_source_available)
{
if (called_from_js_thread)
{
Expand Down Expand Up @@ -4598,7 +4599,8 @@ gum_v8_value_from_ffi_type (GumV8Core * core,
static GumV8ThreadData *
get_gum_v8_thread_data ()
{
GumV8ThreadData * data = (GumV8ThreadData *) g_private_get (&gum_v8_thread_data);
GumV8ThreadData * data =
(GumV8ThreadData *) g_private_get (&gum_v8_thread_data);

if (data == NULL)
{
Expand Down
14 changes: 9 additions & 5 deletions tests/gumjs/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -6138,7 +6138,7 @@ TESTCASE (recv_wait_in_an_application_thread_should_not_deadlock)
}

COMPILE_AND_LOAD_SCRIPT (
"Interceptor.replace(" GUM_PTR_CONST ", new NativeCallback(function (arg) {"
"Interceptor.replace(" GUM_PTR_CONST ", new NativeCallback((arg) => {"
" let timeToRecv;"
" let shouldExit = false;"
" while (true) {"
Expand All @@ -6148,7 +6148,8 @@ TESTCASE (recv_wait_in_an_application_thread_should_not_deadlock)
" return;"
" }"
" else if (message.type != 'waituntil') {"
" throw new Error('Received unexpected message: ' + message.type); }"
" throw new Error("
" 'Received unexpected message: ' + message.type); }"
" timeToRecv = message.time;"
" }).wait();"
" if (shouldExit) {"
Expand All @@ -6157,7 +6158,8 @@ TESTCASE (recv_wait_in_an_application_thread_should_not_deadlock)
" while (Date.now() < timeToRecv) {};"
" recv(message => {"
" if (message.type != 'ping') {"
" throw new Error('Received unexpected message: ' + message.type); }"
" throw new Error("
" 'Received unexpected message: ' + message.type); }"
" }).wait();"
" send('pong');"
" }"
Expand All @@ -6175,9 +6177,11 @@ TESTCASE (recv_wait_in_an_application_thread_should_not_deadlock)
for (int i = 0; i < 100; i++)
{
gint64 timeNow = g_get_real_time ();
gint64 timeToScheduleRecv = timeNow - (timeNow % (20 * 1000)) + 50 * 1000;
gint64 timeToScheduleRecv =
timeNow - (timeNow % (20 * 1000)) + 50 * 1000;
GString * msg = g_string_new (NULL);
g_string_printf (msg, "{\"type\":\"waituntil\", \"time\": %lld}", timeToScheduleRecv / 1000);
g_string_printf (msg, "{\"type\":\"waituntil\", \"time\": %lld}",
timeToScheduleRecv / 1000);
POST_MESSAGE (msg->str);
g_string_free (msg, true);
gint64 timeToPost = timeToScheduleRecv + i;
Expand Down

0 comments on commit 5a9e7b8

Please sign in to comment.