aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/atexit.cpp
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.ru>2022-02-10 16:46:31 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:31 +0300
commit11a24635da4c4f39428b182c49a7bc35e47c9534 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system/atexit.cpp
parent317da38588b7898a99fd9168571408123350012b (diff)
downloadydb-11a24635da4c4f39428b182c49a7bc35e47c9534.tar.gz
Restoring authorship annotation for <swarmer@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/atexit.cpp')
-rw-r--r--util/system/atexit.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp
index 9f77f07a06..74fb10b6b1 100644
--- a/util/system/atexit.cpp
+++ b/util/system/atexit.cpp
@@ -1,5 +1,5 @@
#include "atexit.h"
-#include "atomic.h"
+#include "atomic.h"
#include "yassert.h"
#include "spinlock.h"
#include "thread.h"
@@ -77,29 +77,29 @@ namespace {
};
static TAtomic atExitLock = 0;
- static TAtExit* volatile atExitPtr = nullptr;
+ static TAtExit* volatile atExitPtr = nullptr;
alignas(TAtExit) static char atExitMem[sizeof(TAtExit)];
static void OnExit() {
- if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
+ if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
atExit->Finish();
atExit->~TAtExit();
- AtomicSet(atExitPtr, nullptr);
+ AtomicSet(atExitPtr, nullptr);
}
}
static inline TAtExit* Instance() {
- if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
- return atExit;
- }
+ if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
+ return atExit;
+ }
with_lock (atExitLock) {
- if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
- return atExit;
+ if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
+ return atExit;
}
- atexit(OnExit);
- TAtExit* const atExit = new (atExitMem) TAtExit;
- AtomicSet(atExitPtr, atExit);
- return atExit;
+ atexit(OnExit);
+ TAtExit* const atExit = new (atExitMem) TAtExit;
+ AtomicSet(atExitPtr, atExit);
+ return atExit;
}
}
}
@@ -109,10 +109,10 @@ void ManualRunAtExitFinalizers() {
}
bool ExitStarted() {
- if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
- return atExit->FinishStarted();
+ if (TAtExit* const atExit = AtomicGet(atExitPtr)) {
+ return atExit->FinishStarted();
}
- return false;
+ return false;
}
void AtExit(TAtExitFunc func, void* ctx, size_t priority) {