summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-09-07 15:28:30 -0700
committerDianne Hackborn <hackbod@google.com>2010-09-07 15:46:55 -0700
commit45e0acb41acf30a1b7592ea7e695d96aca3ccd3b (patch)
tree4ceee64976a29f0284f4040e2ede335a158a56b3 /include
parentdd5572047a3b9e75e836e4af8963e87727f5f420 (diff)
downloadframeworks_native-45e0acb41acf30a1b7592ea7e695d96aca3ccd3b.zip
frameworks_native-45e0acb41acf30a1b7592ea7e695d96aca3ccd3b.tar.gz
frameworks_native-45e0acb41acf30a1b7592ea7e695d96aca3ccd3b.tar.bz2
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
Diffstat (limited to 'include')
-rw-r--r--include/utils/PollLoop.h14
1 files changed, 11 insertions, 3 deletions
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();