When schedule many Tickers one after the other with the same time interval 100ms and then wait 105ms it's expected that after this time all Tickers will be fired once. But we get other results. There is no action test hangs and timeout occurs
Problem noticed in https://github.com/ARMmbed/mbed-os/pull/5261 in the following test
/** Test many tickers run one after the other
Given many Tickers
When schedule them one after the other with the same time intervals
Then tickers properly execute callbacks
When schedule them one after the other with the different time intervals
Then tickers properly execute callbacks
*/
void test_multi_ticker(void)
Sample code for reproduction
#define MULTI_TICKER_TIME_MS 100
#define TICKER_COUNT 16
Ticker ticker[TICKER_COUNT];
uint32_t multi_counter;
void increment_multi_counter(void)
{
core_util_atomic_incr_u32(&multi_counter, 1);
}
const uint32_t extra_wait = 5; // extra 5ms wait time
multi_counter = 0;
for (int i = 0; i < TICKER_COUNT; i++) {
ticker[i].attach_us(callback(increment_multi_counter), MULTI_TICKER_TIME_MS * 1000);
}
Thread::wait(MULTI_TICKER_TIME_MS + extra_wait);
for (int i = 0; i < TICKER_COUNT; i++) {
ticker[i].detach();
}
TEST_ASSERT_EQUAL(TICKER_COUNT, multi_counter);
Target
MAX32630, MAX32625
Toolchain:
GCC_ARM|ARM|IAR
mbed-os sha:
master
Expected behavior
Ticker callback is executed exactly 16 times
Actual behavior
Test hung and timeout occurs
cc @kgills @jeremybrodt
@ARMmbed/team-maximintegrated
ping
@jessexm
ping @ARMmbed/team-maximintegrated @jessexm
Currently testing fix.
@jessexm Let us know if any problem
@jessexm what is the status of the fix?
ARM Internal Ref: MBOTRIAGE-153
Two fixes addressed this issue (referenced above)