Oma*_*abi 4 android event-handling android-ndk
在Android的NDK,之间有什么区别ALooper_pollOnce()和ALooper_pollAll()?
这些简单的指定从 Looper 的事件队列处理多少(最大)回调。顾名思义,pollAll()执行事件队列中的所有回调,直到遇到数据事件、错误或超时。另一方面,pollOnce()一旦执行第一个回调就返回 ALOOPER_POLL_CALLBACK。
基本上,它们的关系可以用以下伪代码表示:
int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData) {
int result;
do {
result = ALooper_pollOnce(timeoutMillis, outFd, outEvents, outData);
} while (result == ALOOPER_POLL_CALLBACK);
return result;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2105 次 |
| 最近记录: |