diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/android.c b/src/android.c index 4414d465107..873d821361c 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -272,7 +272,7 @@ void *unused_pointer; | |||
| 272 | struct android_event_container | 272 | struct android_event_container |
| 273 | { | 273 | { |
| 274 | /* The next and last events in this queue. */ | 274 | /* The next and last events in this queue. */ |
| 275 | struct android_event_container *volatile next, *last; | 275 | struct android_event_container *next, *last; |
| 276 | 276 | ||
| 277 | /* The event itself. */ | 277 | /* The event itself. */ |
| 278 | union android_event event; | 278 | union android_event event; |
| @@ -301,11 +301,11 @@ struct android_event_queue | |||
| 301 | }; | 301 | }; |
| 302 | 302 | ||
| 303 | /* Arguments to pselect used by the select thread. */ | 303 | /* Arguments to pselect used by the select thread. */ |
| 304 | static volatile int android_pselect_nfds; | 304 | static int android_pselect_nfds; |
| 305 | static fd_set *volatile android_pselect_readfds; | 305 | static fd_set *android_pselect_readfds; |
| 306 | static fd_set *volatile android_pselect_writefds; | 306 | static fd_set *android_pselect_writefds; |
| 307 | static fd_set *volatile android_pselect_exceptfds; | 307 | static fd_set *android_pselect_exceptfds; |
| 308 | static struct timespec *volatile android_pselect_timeout; | 308 | static struct timespec *android_pselect_timeout; |
| 309 | 309 | ||
| 310 | /* Value of pselect. */ | 310 | /* Value of pselect. */ |
| 311 | static int android_pselect_rc; | 311 | static int android_pselect_rc; |
| @@ -569,12 +569,20 @@ android_pending (void) | |||
| 569 | return i; | 569 | return i; |
| 570 | } | 570 | } |
| 571 | 571 | ||
| 572 | /* Forward declaration. */ | ||
| 573 | |||
| 574 | static void android_check_query (void); | ||
| 575 | |||
| 572 | /* Wait for events to become available synchronously. Return once an | 576 | /* Wait for events to become available synchronously. Return once an |
| 573 | event arrives. */ | 577 | event arrives. Also, reply to the UI thread whenever it requires a |
| 578 | response. */ | ||
| 574 | 579 | ||
| 575 | void | 580 | void |
| 576 | android_wait_event (void) | 581 | android_wait_event (void) |
| 577 | { | 582 | { |
| 583 | /* Run queries from the UI thread to the Emacs thread. */ | ||
| 584 | android_check_query (); | ||
| 585 | |||
| 578 | pthread_mutex_lock (&event_queue.mutex); | 586 | pthread_mutex_lock (&event_queue.mutex); |
| 579 | 587 | ||
| 580 | /* Wait for events to appear if there are none available to | 588 | /* Wait for events to appear if there are none available to |
| @@ -584,6 +592,10 @@ android_wait_event (void) | |||
| 584 | &event_queue.mutex); | 592 | &event_queue.mutex); |
| 585 | 593 | ||
| 586 | pthread_mutex_unlock (&event_queue.mutex); | 594 | pthread_mutex_unlock (&event_queue.mutex); |
| 595 | |||
| 596 | /* Check for queries again. If a query is sent after the call to | ||
| 597 | `android_check_query' above, `read_var' will be signaled. */ | ||
| 598 | android_check_query (); | ||
| 587 | } | 599 | } |
| 588 | 600 | ||
| 589 | void | 601 | void |
| @@ -701,10 +713,6 @@ android_write_event (union android_event *event) | |||
| 701 | should answer the query ASAP. */ | 713 | should answer the query ASAP. */ |
| 702 | static bool android_urgent_query; | 714 | static bool android_urgent_query; |
| 703 | 715 | ||
| 704 | /* Forward declaration. */ | ||
| 705 | |||
| 706 | static void android_check_query (void); | ||
| 707 | |||
| 708 | int | 716 | int |
| 709 | android_select (int nfds, fd_set *readfds, fd_set *writefds, | 717 | android_select (int nfds, fd_set *readfds, fd_set *writefds, |
| 710 | fd_set *exceptfds, struct timespec *timeout) | 718 | fd_set *exceptfds, struct timespec *timeout) |