Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
be741f60
Commit
be741f60
authored
May 05, 2016
by
Doron Somech
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
problem: timers test is flapping on windows
parent
a747f724
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
test_timers.cpp
tests/test_timers.cpp
+17
-7
No files found.
tests/test_timers.cpp
View file @
be741f60
...
...
@@ -46,6 +46,19 @@ void handler (int timer_id, void* arg)
*
((
bool
*
)
arg
)
=
true
;
}
int
sleep_and_execute
(
void
*
timers_
)
{
int
timeout
=
zmq_timers_timeout
(
timers_
);
// Sleep methods are inaccurate, so we sleep in a loop until time arrived
while
(
timeout
>
0
)
{
sleep_
(
timeout
);
timeout
=
zmq_timers_timeout
(
timers_
);
}
return
zmq_timers_execute
(
timers_
);
}
int
main
(
void
)
{
setup_test_environment
();
...
...
@@ -69,9 +82,8 @@ int main (void)
assert
(
rc
==
0
);
assert
(
!
timer_invoked
);
// Wait until the end
sleep_
(
zmq_timers_timeout
(
timers
));
rc
=
zmq_timers_execute
(
timers
);
// Wait until the end
rc
=
sleep_and_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
timer_invoked
);
timer_invoked
=
false
;
...
...
@@ -91,16 +103,14 @@ int main (void)
assert
(
!
timer_invoked
);
// Wait until the end
sleep_
(
zmq_timers_timeout
(
timers
));
rc
=
zmq_timers_execute
(
timers
);
rc
=
sleep_and_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
timer_invoked
);
timer_invoked
=
false
;
// reschedule
zmq_timers_set_interval
(
timers
,
timer_id
,
50
);
sleep_
(
51
);
rc
=
zmq_timers_execute
(
timers
);
rc
=
sleep_and_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
timer_invoked
);
timer_invoked
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment