summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-09-16 18:28:12 -0700
committerJeff Brown <jeffbrown@google.com>2010-09-16 18:51:15 -0700
commitb0619e8ad8e258f3e87a78a3a23c353d98efafa7 (patch)
tree4bb7bce0d27d4915547736ae7c0d6ae3bddb9979 /include
parent888db4d60bb19033f5d7a20cfd2ba5c318c7d74f (diff)
downloadframeworks_native-b0619e8ad8e258f3e87a78a3a23c353d98efafa7.zip
frameworks_native-b0619e8ad8e258f3e87a78a3a23c353d98efafa7.tar.gz
frameworks_native-b0619e8ad8e258f3e87a78a3a23c353d98efafa7.tar.bz2
Looper: Drop default parameters in favor of a safer overload.
The idea is that if you're writing code that wants fd/events/data on return from pollOnce() / pollAll() you should really pass in all of those arguments. When I changed the Looper API earlier, it was difficult to ensure that all callers were passing the right parameters since they were relying on default parameters to some degree so usage mistakes would not have been caught by the compiler. Change-Id: I1f2812894270aaf1515017ac1616b6b312d9b565
Diffstat (limited to 'include')
-rw-r--r--include/utils/Looper.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/utils/Looper.h b/include/utils/Looper.h
index 92e4b0a..7d90866 100644
--- a/include/utils/Looper.h
+++ b/include/utils/Looper.h
@@ -83,16 +83,20 @@ public:
* This method does not return until it has finished invoking the appropriate callbacks
* for all file descriptors that were signalled.
*/
- int pollOnce(int timeoutMillis,
- int* outFd = NULL, int* outEvents = NULL, void** outData = NULL);
+ int pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
+ inline int pollOnce(int timeoutMillis) {
+ return pollOnce(timeoutMillis, NULL, NULL, NULL);
+ }
/**
* Like pollOnce(), but performs all pending callbacks until all
* data has been consumed or a file descriptor is available with no callback.
* This function will never return ALOOPER_POLL_CALLBACK.
*/
- int pollAll(int timeoutMillis,
- int* outFd = NULL, int* outEvents = NULL, void** outData = NULL);
+ int pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);
+ inline int pollAll(int timeoutMillis) {
+ return pollAll(timeoutMillis, NULL, NULL, NULL);
+ }
/**
* Wakes the poll asynchronously.
@@ -128,8 +132,7 @@ public:
* This method can be called on any thread.
* This method may block briefly if it needs to wake the poll.
*/
- int addFd(int fd, int ident,
- int events, ALooper_callbackFunc callback, void* data = NULL);
+ int addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data);
/**
* Removes a previously added file descriptor from the looper.