summaryrefslogtreecommitdiffstats
path: root/include/utils
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
commit42c03e579aade011b451e2a13ea3f44a2ef0056a (patch)
tree1716fbd88e2beb816d303c3d3fa0ca1785b8db61 /include/utils
parent6e86915e8f5dfffa60ae5d1a4ca9aa74912fd026 (diff)
downloadframeworks_base-42c03e579aade011b451e2a13ea3f44a2ef0056a.zip
frameworks_base-42c03e579aade011b451e2a13ea3f44a2ef0056a.tar.gz
frameworks_base-42c03e579aade011b451e2a13ea3f44a2ef0056a.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/utils')
-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();