0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

refactor: use relaxed ordering for atomics

We are still using a lock with the atomics for now,
so the ordering doesn't matter.
This commit is contained in:
MusiKid 2022-01-21 12:18:55 +01:00 committed by musikid
parent e8e1624ea1
commit 4858071532
No known key found for this signature in database
GPG key ID: 7567D43648C6E2F4

View file

@ -277,9 +277,9 @@ int identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
{
unique_lock<mutex> lk(m);
Type type = confirmation_type.load(memory_order_acquire);
Type type = confirmation_type.load(memory_order_relaxed);
if (type == Type::Unset) {
confirmation_type.store(Type::Howdy, memory_order_release);
confirmation_type.store(Type::Howdy, memory_order_relaxed);
}
}
cv.notify_one();
@ -296,9 +296,9 @@ int identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
(const char **)&auth_tok_ptr, nullptr);
{
unique_lock<mutex> lk(m);
Type type = confirmation_type.load(memory_order_acquire);
Type type = confirmation_type.load(memory_order_relaxed);
if (type == Type::Unset) {
confirmation_type.store(Type::Pam, memory_order_release);
confirmation_type.store(Type::Pam, memory_order_relaxed);
}
}
cv.notify_one();
@ -335,7 +335,7 @@ int identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
// We need to be sure that we're not going to block forever if the
// child has a problem
if (child_task.wait(1.5s) == future_status::timeout) {
if (child_task.wait(2.5s) == future_status::timeout) {
kill(child_pid, SIGTERM);
}
child_task.stop(false);