Joedb
10.4.3
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
src
joedb
ui
interruptible_sleep.cpp
Go to the documentation of this file.
1
#include "
joedb/ui/interruptible_sleep.h
"
2
#include "
joedb/Signal.h
"
3
4
#include <thread>
5
#include <algorithm>
6
7
namespace
joedb
8
{
9
bool
interruptible_sleep
(std::chrono::milliseconds duration)
10
{
11
const
std::chrono::milliseconds step{1000};
12
13
for
(;
Signal::get_signal
() != SIGINT && duration.count() > 0;)
14
{
15
const
std::chrono::milliseconds actual_step = std::min(step, duration);
16
std::this_thread::sleep_for(actual_step);
17
duration -= actual_step;
18
}
19
20
return
duration.count() == 0 &&
Signal::get_signal
() != SIGINT;
21
}
22
}
Signal.h
joedb::Signal::get_signal
static int get_signal()
Definition
Signal.cpp:27
joedb::interruptible_sleep
bool interruptible_sleep(std::chrono::milliseconds duration)
Definition
interruptible_sleep.cpp:9
interruptible_sleep.h
joedb
Definition
Server.cpp:10
Generated by
1.9.8