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
8b263d58
Commit
8b263d58
authored
Aug 23, 2017
by
sigiesec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_timers.cpp sleep_ duplicates msleep from testutil
Solution: replace sleep_ my msleep
parent
8f3113b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
16 deletions
+5
-16
test_timers.cpp
tests/test_timers.cpp
+5
-16
No files found.
tests/test_timers.cpp
View file @
8b263d58
...
...
@@ -29,17 +29,6 @@
#include "testutil.hpp"
void
sleep_
(
long
timeout_
)
{
#if defined ZMQ_HAVE_WINDOWS
Sleep
(
timeout_
>
0
?
timeout_
:
INFINITE
);
#elif defined ZMQ_HAVE_ANDROID
usleep
(
timeout_
*
1000
);
#else
usleep
(
timeout_
*
1000
);
#endif
}
void
handler
(
int
timer_id
,
void
*
arg
)
{
(
void
)
timer_id
;
// Stop 'unused' compiler warnings
...
...
@@ -52,7 +41,7 @@ int sleep_and_execute(void *timers_)
// Sleep methods are inaccurate, so we sleep in a loop until time arrived
while
(
timeout
>
0
)
{
sleep_
(
timeout
);
msleep
(
timeout
);
timeout
=
zmq_timers_timeout
(
timers_
);
}
...
...
@@ -77,7 +66,7 @@ int main (void)
assert
(
!
timer_invoked
);
// Wait half the time and check again
sleep_
(
zmq_timers_timeout
(
timers
)
/
2
);
msleep
(
zmq_timers_timeout
(
timers
)
/
2
);
rc
=
zmq_timers_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
!
timer_invoked
);
...
...
@@ -90,14 +79,14 @@ int main (void)
// Wait half the time and check again
long
timeout
=
zmq_timers_timeout
(
timers
);
sleep_
(
timeout
/
2
);
msleep
(
timeout
/
2
);
rc
=
zmq_timers_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
!
timer_invoked
);
// Reset timer and wait half of the time left
rc
=
zmq_timers_reset
(
timers
,
timer_id
);
sleep_
(
timeout
/
2
);
msleep
(
timeout
/
2
);
rc
=
zmq_timers_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
!
timer_invoked
);
...
...
@@ -118,7 +107,7 @@ int main (void)
// cancel timer
timeout
=
zmq_timers_timeout
(
timers
);
zmq_timers_cancel
(
timers
,
timer_id
);
sleep_
(
timeout
*
2
);
msleep
(
timeout
*
2
);
rc
=
zmq_timers_execute
(
timers
);
assert
(
rc
==
0
);
assert
(
!
timer_invoked
);
...
...
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