fixed test for periodic timer

master
Dvir Volk 7 years ago
parent 15cf5eac10
commit 3e4daab6dc

@ -12,15 +12,14 @@ void timerCb(RedisModuleCtx *ctx, void *p) {
int testPeriodic() { int testPeriodic() {
int x = 0; int x = 0;
struct RMUtilTimer *tm = struct RMUtilTimer *tm = RMUtil_NewPeriodicTimer(
RMUtil_NewPeriodicTimer(timerCb, &x, (struct timespec){.tv_sec = 0, .tv_nsec = 10000000}); timerCb, NULL, &x, (struct timespec){.tv_sec = 0, .tv_nsec = 10000000});
sleep(1); sleep(1);
ASSERT_EQUAL(0, RMUtilTimer_Stop(tm)); ASSERT_EQUAL(0, RMUtilTimer_Terminate(tm));
ASSERT(x > 0); ASSERT(x > 0);
ASSERT(x <= 100); ASSERT(x <= 100);
RMUtilTimer_Free(tm);
return 0; return 0;
} }

Loading…
Cancel
Save