aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/android.c b/src/android.c
index ffeb4b659d9..9c600be6cdf 100644
--- a/src/android.c
+++ b/src/android.c
@@ -344,12 +344,15 @@ android_run_select_thread (void *data)
344 android_pselect_rc = rc; 344 android_pselect_rc = rc;
345 pthread_mutex_unlock (&event_queue.select_mutex); 345 pthread_mutex_unlock (&event_queue.select_mutex);
346 346
347 /* Signal the main thread that there is now data to read. 347 /* Signal the main thread that there is now data to read. Hold
348 It is ok to signal this condition variable without holding 348 the event queue lock during this process to make sure this
349 the event queue lock, because android_select will always 349 does not happen before the main thread begins to wait for the
350 wait for this to complete before returning. */ 350 condition variable. */
351
352 pthread_mutex_lock (&event_queue.mutex);
351 android_pselect_completed = true; 353 android_pselect_completed = true;
352 pthread_cond_broadcast (&event_queue.read_var); 354 pthread_cond_broadcast (&event_queue.read_var);
355 pthread_mutex_unlock (&event_queue.mutex);
353 356
354 /* Read a single byte from the select pipe. */ 357 /* Read a single byte from the select pipe. */
355 read (select_pipe[0], &byte, 1); 358 read (select_pipe[0], &byte, 1);
@@ -392,10 +395,10 @@ android_run_select_thread (void *data)
392 does not happen before the main thread begins to wait for the 395 does not happen before the main thread begins to wait for the
393 condition variable. */ 396 condition variable. */
394 397
395 pthread_mutex_lock (&event_queue.select_mutex); 398 pthread_mutex_lock (&event_queue.mutex);
396 android_pselect_completed = true; 399 android_pselect_completed = true;
397 pthread_cond_broadcast (&event_queue.read_var); 400 pthread_cond_broadcast (&event_queue.read_var);
398 pthread_mutex_unlock (&event_queue.select_mutex); 401 pthread_mutex_unlock (&event_queue.mutex);
399 402
400 if (rc != -1 || errno != EINTR) 403 if (rc != -1 || errno != EINTR)
401 /* Now, wait for SIGUSR1, unless pselect was interrupted and 404 /* Now, wait for SIGUSR1, unless pselect was interrupted and