mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #6418 from amq/poll-lowpowertimer
Add an option to use LowPowerTimer for pollpull/6625/head
commit
339283b3b8
|
@ -34,6 +34,11 @@
|
|||
"force-non-copyable-error": {
|
||||
"help": "Force compile time error when a NonCopyable object is copied",
|
||||
"value": false
|
||||
},
|
||||
|
||||
"poll-use-lowpower-timer": {
|
||||
"help": "Enable use of low power timer class for poll(). May cause missing events.",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"target_overrides": {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mbed_poll.h"
|
||||
#include "FileHandle.h"
|
||||
#include "Timer.h"
|
||||
#include "LowPowerTimer.h"
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
#include "rtos/Thread.h"
|
||||
#endif
|
||||
|
@ -34,7 +35,11 @@ int poll(pollfh fhs[], unsigned nfhs, int timeout)
|
|||
* interested in. In future, his spinning behaviour will be replaced with
|
||||
* condition variables.
|
||||
*/
|
||||
#if MBED_CONF_PLATFORM_POLL_USE_LOWPOWER_TIMER
|
||||
LowPowerTimer timer;
|
||||
#else
|
||||
Timer timer;
|
||||
#endif
|
||||
if (timeout > 0) {
|
||||
timer.start();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue