@@ -90,20 +90,23 @@ enum {
9090 ALOOPER_POLL_WAKE = -1 ,
9191
9292 /**
93- * Result from ALooper_pollOnce() and ALooper_pollAll():
94- * One or more callbacks were executed.
93+ * Result from ALooper_pollOnce():
94+ * One or more callbacks were executed. The poll may also have been
95+ * explicitly woken by ALooper_wake().
9596 */
9697 ALOOPER_POLL_CALLBACK = -2 ,
9798
9899 /**
99100 * Result from ALooper_pollOnce() and ALooper_pollAll():
100- * The timeout expired.
101+ * The timeout expired. The poll may also have been explicitly woken by
102+ * ALooper_wake().
101103 */
102104 ALOOPER_POLL_TIMEOUT = -3 ,
103105
104106 /**
105107 * Result from ALooper_pollOnce() and ALooper_pollAll():
106- * An error occurred.
108+ * An error occurred. The poll may also have been explicitly woken by
109+ * ALooper_wake(()).
107110 */
108111 ALOOPER_POLL_ERROR = -4 ,
109112};
@@ -182,10 +185,13 @@ typedef int (*ALooper_callbackFunc)(int fd, int events, void* data);
182185 * If the timeout is zero, returns immediately without blocking.
183186 * If the timeout is negative, waits indefinitely until an event appears.
184187 *
188+ * **All return values may also imply ALOOPER_POLL_WAKE.** If you call this in a
189+ * loop, you must treat all return values as if they also indicated
190+ * ALOOPER_POLL_WAKE.
191+ *
185192 * Returns ALOOPER_POLL_WAKE if the poll was awoken using ALooper_wake() before
186193 * the timeout expired and no callbacks were invoked and no other file
187- * descriptors were ready. **All return values may also imply
188- * ALOOPER_POLL_WAKE.**
194+ * descriptors were ready.
189195 *
190196 * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked. The poll
191197 * may also have been explicitly woken by ALooper_wake.
@@ -214,9 +220,9 @@ int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa
214220 * data has been consumed or a file descriptor is available with no callback.
215221 * This function will never return ALOOPER_POLL_CALLBACK.
216222 *
217- * This API cannot be used safely, but a safe alternative exists (see below). As
218- * such, new builds will not be able to call this API and must migrate to the
219- * safe API. Binary compatibility is preserved to support already-compiled apps.
223+ * This API will not reliably respond to ALooper_wake. As such, this API is
224+ * hidden and callers should migrate to ALooper_pollOnce. Binary compatibility
225+ * is preserved to support already-compiled apps.
220226 *
221227 * \bug ALooper_pollAll will not wake in response to ALooper_wake calls if it
222228 * also handles another event at the same time.
@@ -235,6 +241,8 @@ int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outDat
235241 *
236242 * This method can be called on any thread.
237243 * This method returns immediately.
244+ *
245+ * \bug ALooper_pollAll will not reliably wake in response to ALooper_wake.
238246 */
239247void ALooper_wake (ALooper * looper );
240248
0 commit comments