diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/android.c b/src/android.c index e74d40a0cdb..f59c0d9e5d2 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -2997,6 +2997,7 @@ NATIVE_NAME (blitRect) (JNIEnv *env, jobject object, | |||
| 2997 | 2997 | ||
| 2998 | static void android_begin_query (void); | 2998 | static void android_begin_query (void); |
| 2999 | static void android_end_query (void); | 2999 | static void android_end_query (void); |
| 3000 | static void android_answer_query_spin (void); | ||
| 3000 | 3001 | ||
| 3001 | JNIEXPORT void JNICALL | 3002 | JNIEXPORT void JNICALL |
| 3002 | NATIVE_NAME (beginSynchronous) (JNIEnv *env, jobject object) | 3003 | NATIVE_NAME (beginSynchronous) (JNIEnv *env, jobject object) |
| @@ -3014,6 +3015,14 @@ NATIVE_NAME (endSynchronous) (JNIEnv *env, jobject object) | |||
| 3014 | android_end_query (); | 3015 | android_end_query (); |
| 3015 | } | 3016 | } |
| 3016 | 3017 | ||
| 3018 | JNIEXPORT void JNICALL | ||
| 3019 | NATIVE_NAME (answerQuerySpin) (JNIEnv *env, jobject object) | ||
| 3020 | { | ||
| 3021 | JNI_STACK_ALIGNMENT_PROLOGUE; | ||
| 3022 | |||
| 3023 | android_answer_query_spin (); | ||
| 3024 | } | ||
| 3025 | |||
| 3017 | #ifdef __clang__ | 3026 | #ifdef __clang__ |
| 3018 | #pragma clang diagnostic pop | 3027 | #pragma clang diagnostic pop |
| 3019 | #else | 3028 | #else |
| @@ -7041,6 +7050,23 @@ android_answer_query (void) | |||
| 7041 | sem_post (&android_query_sem); | 7050 | sem_post (&android_query_sem); |
| 7042 | } | 7051 | } |
| 7043 | 7052 | ||
| 7053 | /* Like `android_answer_query'. However, the query may not have | ||
| 7054 | begun; spin until it has. */ | ||
| 7055 | |||
| 7056 | static void | ||
| 7057 | android_answer_query_spin (void) | ||
| 7058 | { | ||
| 7059 | int n; | ||
| 7060 | |||
| 7061 | while (!(n = __atomic_load_n (&android_servicing_query, | ||
| 7062 | __ATOMIC_SEQ_CST))) | ||
| 7063 | eassert (!n); | ||
| 7064 | |||
| 7065 | /* Note that this function is supposed to be called before | ||
| 7066 | `android_begin_query' starts, so clear the service flag. */ | ||
| 7067 | android_check_query (); | ||
| 7068 | } | ||
| 7069 | |||
| 7044 | /* Notice that the Emacs thread will start blocking waiting for a | 7070 | /* Notice that the Emacs thread will start blocking waiting for a |
| 7045 | response from the UI thread. Process any pending queries from the | 7071 | response from the UI thread. Process any pending queries from the |
| 7046 | UI thread. | 7072 | UI thread. |