aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/zencore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/zencore.cpp')
-rw-r--r--src/zencore/zencore.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/zencore/zencore.cpp b/src/zencore/zencore.cpp
index d0acac608..b80b1d280 100644
--- a/src/zencore/zencore.cpp
+++ b/src/zencore/zencore.cpp
@@ -115,11 +115,16 @@ IsApplicationExitRequested()
return s_ApplicationExitRequested;
}
-void
+bool
RequestApplicationExit(int ExitCode)
{
- s_ApplicationExitCode = ExitCode;
- s_ApplicationExitRequested = true;
+ bool Expected = false;
+ if (s_ApplicationExitRequested.compare_exchange_weak(Expected, true))
+ {
+ s_ApplicationExitCode = ExitCode;
+ return true;
+ }
+ return false;
}
int