mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-03 12:58:05 +01:00
Problem: Magic numbers "1" and "100" in signaler.cpp
Solution: introduced constants, use std::min/std::max instead of control structures
This commit is contained in:
parent
a6060674b4
commit
2da6629e0f
@ -99,11 +99,10 @@ static int sleep_ms (unsigned int ms_)
|
|||||||
static int close_wait_ms (int fd_, unsigned int max_ms_ = 2000)
|
static int close_wait_ms (int fd_, unsigned int max_ms_ = 2000)
|
||||||
{
|
{
|
||||||
unsigned int ms_so_far = 0;
|
unsigned int ms_so_far = 0;
|
||||||
unsigned int step_ms = max_ms_ / 10;
|
const unsigned int min_step_ms = 1;
|
||||||
if (step_ms < 1)
|
const unsigned int max_step_ms = 100;
|
||||||
step_ms = 1;
|
const unsigned int step_ms =
|
||||||
if (step_ms > 100)
|
std::min (std::max (min_step_ms, max_ms_ / 10), max_step_ms);
|
||||||
step_ms = 100;
|
|
||||||
|
|
||||||
int rc = 0; // do not sleep on first attempt
|
int rc = 0; // do not sleep on first attempt
|
||||||
do {
|
do {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user