Browse Source

tests: cpp11_condition_variable: vtimer to xtimer

cc430
Cenk Gündoğan 7 years ago
parent
commit
2672787ccb
  1. 2
      tests/cpp11_condition_variable/Makefile
  2. 8
      tests/cpp11_condition_variable/main.cpp

2
tests/cpp11_condition_variable/Makefile

@ -28,7 +28,7 @@ QUIET ?= 1
CXXEXFLAGS += -std=c++11
USEMODULE += cpp11-compat
USEMODULE += vtimer
USEMODULE += xtimer
USEMODULE += timex
include $(RIOTBASE)/Makefile.include

8
tests/cpp11_condition_variable/main.cpp

@ -98,9 +98,9 @@ int main() {
condition_variable cv;
timex_t before, after;
unique_lock<mutex> lk(m);
vtimer_now(&before);
xtimer_now_timex(&before);
cv.wait_for(lk, chrono::seconds(timeout));
vtimer_now(&after);
xtimer_now_timex(&after);
auto diff = timex_sub(after, before);
assert(diff.seconds >= timeout);
}
@ -114,10 +114,10 @@ int main() {
condition_variable cv;
timex_t before, after;
unique_lock<mutex> lk(m);
vtimer_now(&before);
xtimer_now_timex(&before);
auto time = riot::now() += chrono::seconds(timeout);
cv.wait_until(lk, time);
vtimer_now(&after);
xtimer_now_timex(&after);
auto diff = timex_sub(after, before);
assert(diff.seconds >= timeout);
}

Loading…
Cancel
Save