mdbx-test: using std::atomic<> instead of sig_atomic_t.

Change-Id: I37d0c2768ec54ddd3c529d4b9a29f66df6ca265e
This commit is contained in:
Leonid Yuriev 2020-06-26 03:33:53 +03:00
parent 95199c754a
commit 2ee45b1820

View File

@ -23,6 +23,8 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <atomic>
#ifndef MDBX_LOCKING #ifndef MDBX_LOCKING
#error "Opps, MDBX_LOCKING is undefined!" #error "Opps, MDBX_LOCKING is undefined!"
#endif #endif
@ -307,14 +309,14 @@ bool actor_config::osal_deserialize(const char *str, const char *end,
static pid_t overlord_pid; static pid_t overlord_pid;
static volatile sig_atomic_t sigusr1_head, sigusr2_head; static std::atomic<int> sigusr1_head, sigusr2_head;
static void handler_SIGUSR(int signum) { static void handler_SIGUSR(int signum) {
switch (signum) { switch (signum) {
case SIGUSR1: case SIGUSR1:
sigusr1_head += 1; ++sigusr1_head;
return; return;
case SIGUSR2: case SIGUSR2:
sigusr2_head += 1; ++sigusr2_head;
return; return;
default: default:
abort(); abort();
@ -335,10 +337,10 @@ bool osal_progress_push(bool active) {
static std::unordered_map<pid_t, actor_status> childs; static std::unordered_map<pid_t, actor_status> childs;
static volatile sig_atomic_t sigalarm_head; static std::atomic<int> sigalarm_head;
static void handler_SIGCHLD(int signum) { static void handler_SIGCHLD(int signum) {
if (signum == SIGALRM) if (signum == SIGALRM)
sigalarm_head += 1; ++sigalarm_head;
} }
mdbx_pid_t osal_getpid(void) { return getpid(); } mdbx_pid_t osal_getpid(void) { return getpid(); }