diff options
| author | Po Lu | 2025-02-28 19:49:34 +0800 |
|---|---|---|
| committer | Po Lu | 2025-02-28 19:54:46 +0800 |
| commit | 8df582a46836e312ef3bfc36c8038b5f4a2c0d9b (patch) | |
| tree | 752e9136202a8bfaa81000078a5a15e14d919d3e /src/thread.c | |
| parent | 8b9194ae03214dd5169bd84f7d83bbe660dd9f90 (diff) | |
| download | emacs-8df582a46836e312ef3bfc36c8038b5f4a2c0d9b.tar.gz emacs-8df582a46836e312ef3bfc36c8038b5f4a2c0d9b.zip | |
Fully support Lisp threads on Android
* src/android.c (struct android_thread_event_queue): New
structure. Move global pselect arguments, mutexes, and
semaphores, and pipes here.
(struct android_event_queue) <select_mutex, select_thread>:
Remove to the above-named struct.
(android_init_thread_events, android_finalize_thread_events)
(android_get_poll_thread): New functions.
(android_run_select_thread): Accept a set of mutexes and
thread-local data as the first argument, and operate with them
rather than globals.
(android_handle_sigusr1): Rename to
`android_handle_poll_signal'. Set thread-specific cancellation
indicator.
(android_init_events): Properly abort after a fatal condition.
Enable interruptible polling on Android 5.1 and later, not 4.2.
(android_select): Never check for queries here, but in
thread_select, if threads are enabled. Adapt to per-thread
polling threads and only enable interruptible polling on Android
5.1 and later.
(android_before_select): New function.
* src/android.h (android_before_select): New declaration.
* src/thread.c (thread_select): Call `android_before_select'
before the global lock is released.
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/thread.c b/src/thread.c index 5610f8be0dd..8fd713d0c81 100644 --- a/src/thread.c +++ b/src/thread.c | |||
| @@ -653,6 +653,9 @@ thread_select (select_func *func, int max_fds, fd_set *rfds, | |||
| 653 | sa.efds = efds; | 653 | sa.efds = efds; |
| 654 | sa.timeout = timeout; | 654 | sa.timeout = timeout; |
| 655 | sa.sigmask = sigmask; | 655 | sa.sigmask = sigmask; |
| 656 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY | ||
| 657 | android_before_select (); | ||
| 658 | #endif /* HAVE_ANDROID && !defined ANDROID_STUBIFY */ | ||
| 656 | flush_stack_call_func (really_call_select, &sa); | 659 | flush_stack_call_func (really_call_select, &sa); |
| 657 | return sa.result; | 660 | return sa.result; |
| 658 | } | 661 | } |