Skip to content

Commit 339283b

Browse files
author
Cruz Monrreal
authored
Merge pull request #6418 from amq/poll-lowpowertimer
Add an option to use LowPowerTimer for poll
2 parents 5234075 + fc412bb commit 339283b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

platform/mbed_lib.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
"force-non-copyable-error": {
3535
"help": "Force compile time error when a NonCopyable object is copied",
3636
"value": false
37+
},
38+
39+
"poll-use-lowpower-timer": {
40+
"help": "Enable use of low power timer class for poll(). May cause missing events.",
41+
"value": false
3742
}
3843
},
3944
"target_overrides": {

platform/mbed_poll.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "mbed_poll.h"
1717
#include "FileHandle.h"
1818
#include "Timer.h"
19+
#include "LowPowerTimer.h"
1920
#ifdef MBED_CONF_RTOS_PRESENT
2021
#include "rtos/Thread.h"
2122
#endif
@@ -34,7 +35,11 @@ int poll(pollfh fhs[], unsigned nfhs, int timeout)
3435
* interested in. In future, his spinning behaviour will be replaced with
3536
* condition variables.
3637
*/
38+
#if MBED_CONF_PLATFORM_POLL_USE_LOWPOWER_TIMER
39+
LowPowerTimer timer;
40+
#else
3741
Timer timer;
42+
#endif
3843
if (timeout > 0) {
3944
timer.start();
4045
}

0 commit comments

Comments
 (0)