From 45e0acb41acf30a1b7592ea7e695d96aca3ccd3b Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 7 Sep 2010 15:28:30 -0700 Subject: Modify native ALooper to take an explicit ident. The ALooper API now uses an explicit "identifier" for the integer that is returned rather than implicitly using the fd. This allows the APIs that had the fd to be a little more sane. Change-Id: I8507f535ad484c0bdc4a1bd016d87bb09acd7ff0 --- include/utils/PollLoop.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/utils/PollLoop.h b/include/utils/PollLoop.h index 81230e8..bc616eb 100644 --- a/include/utils/PollLoop.h +++ b/include/utils/PollLoop.h @@ -111,12 +111,18 @@ public: * This method can be called on any thread. * This method may block briefly if it needs to wake the poll loop. */ - void setCallback(int fd, int events, Callback callback, void* data = NULL); + void setCallback(int fd, int ident, int events, Callback callback, void* data = NULL); /** + * Convenience for above setCallback when ident is not used. In this case + * the ident is set to POLL_CALLBACK. + */ + void setCallback(int fd, int events, Callback callback, void* data = NULL); + + /** * Like setCallback(), but for the NDK callback function. */ - void setLooperCallback(int fd, int events, ALooper_callbackFunc* callback, + void setLooperCallback(int fd, int ident, int events, ALooper_callbackFunc* callback, void* data); /** @@ -153,11 +159,13 @@ private: struct RequestedCallback { Callback callback; ALooper_callbackFunc* looperCallback; + int ident; void* data; }; struct PendingCallback { int fd; + int ident; int events; Callback callback; ALooper_callbackFunc* looperCallback; @@ -185,7 +193,7 @@ private: void openWakePipe(); void closeWakePipe(); - void setCallbackCommon(int fd, int events, Callback callback, + void setCallbackCommon(int fd, int ident, int events, Callback callback, ALooper_callbackFunc* looperCallback, void* data); ssize_t getRequestIndexLocked(int fd); void wakeAndLock(); -- cgit v1.1