diff options
| author | Per Larsson <[email protected]> | 2021-09-17 13:11:04 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-17 13:11:04 +0200 |
| commit | d812fcc3eab88733cbef084eefd089d22177aae4 (patch) | |
| tree | bb64fa6c64f9707246577de148749b35d1e25987 /zencore | |
| parent | Added helper function for iterating string tokens. (diff) | |
| parent | Added namespace scopes to more includes for better consistency (diff) | |
| download | zen-d812fcc3eab88733cbef084eefd089d22177aae4.tar.xz zen-d812fcc3eab88733cbef084eefd089d22177aae4.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zencore')
| -rw-r--r-- | zencore/include/zencore/thread.h | 4 | ||||
| -rw-r--r-- | zencore/include/zencore/uid.h | 1 | ||||
| -rw-r--r-- | zencore/include/zencore/zencore.h | 4 | ||||
| -rw-r--r-- | zencore/thread.cpp | 4 | ||||
| -rw-r--r-- | zencore/uid.cpp | 8 | ||||
| -rw-r--r-- | zencore/zencore.cpp | 8 |
6 files changed, 23 insertions, 6 deletions
diff --git a/zencore/include/zencore/thread.h b/zencore/include/zencore/thread.h index 0e34d6518..e65867ec4 100644 --- a/zencore/include/zencore/thread.h +++ b/zencore/include/zencore/thread.h @@ -128,7 +128,7 @@ private: }; /** Basic process abstraction - */ + */ class ProcessHandle { public: @@ -155,7 +155,7 @@ private: /** Process monitor - monitors a list of running processes via polling - Intended to be used to monitor a set of "sponsor" processes, where + Intended to be used to monitor a set of "sponsor" processes, where we need to determine when none of them remain alive */ diff --git a/zencore/include/zencore/uid.h b/zencore/include/zencore/uid.h index 2730b1415..f095c49ef 100644 --- a/zencore/include/zencore/uid.h +++ b/zencore/include/zencore/uid.h @@ -60,6 +60,7 @@ struct Oid const Oid& Generate(); [[nodiscard]] static Oid FromHexString(const std::string_view String); StringBuilderBase& ToString(StringBuilderBase& OutString) const; + [[nodiscard]] static Oid FromMemory(const void* Ptr); auto operator<=>(const Oid& rhs) const = default; [[nodiscard]] inline operator bool() const { return *this == Zero; } diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h index 54df7e85e..da17e61e3 100644 --- a/zencore/include/zencore/zencore.h +++ b/zencore/include/zencore/zencore.h @@ -150,12 +150,16 @@ char (&ZenArrayCountHelper(const T (&)[N]))[N + 1]; #define ZEN_NOT_IMPLEMENTED(...) ZEN_ASSERT(false, __VA_ARGS__) #define ZENCORE_API // Placeholder to allow DLL configs in the future +namespace zen { + ZENCORE_API bool IsPointerToStack(const void* ptr); // Query if pointer is within the stack of the currently executing thread ZENCORE_API bool IsApplicationExitRequested(); ZENCORE_API void RequestApplicationExit(int ExitCode); ZENCORE_API void zencore_forcelinktests(); +} + ////////////////////////////////////////////////////////////////////////// #if ZEN_COMPILER_MSC diff --git a/zencore/thread.cpp b/zencore/thread.cpp index ee00d38d4..1c7e4b3ab 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -76,7 +76,7 @@ Event::Reset() ResetEvent(m_EventHandle); } -void +void Event::Close() { CloseHandle(m_EventHandle); @@ -291,7 +291,7 @@ ProcessMonitor::IsRunning() { DWORD ExitCode = 0; GetExitCodeProcess(Proc, &ExitCode); - + if (ExitCode != STILL_ACTIVE) { CloseHandle(Proc); diff --git a/zencore/uid.cpp b/zencore/uid.cpp index acf9f9790..d946638ec 100644 --- a/zencore/uid.cpp +++ b/zencore/uid.cpp @@ -83,6 +83,14 @@ Oid::FromHexString(const std::string_view String) } } +Oid +Oid::FromMemory(const void* Ptr) +{ + Oid Id; + memcpy(Id.OidBits, Ptr, sizeof Id); + return Id; +} + StringBuilderBase& Oid::ToString(StringBuilderBase& OutString) const { diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index f179880e4..5899f014d 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -28,6 +28,8 @@ #include <zencore/timer.h> #include <zencore/uid.h> +namespace zen { + bool IsPointerToStack(const void* ptr) { @@ -53,11 +55,11 @@ IsPointerToStack(const void* ptr) #endif } -zen::AssertException::AssertException(const char* Msg) : m_Msg(Msg) +AssertException::AssertException(const char* Msg) : m_Msg(Msg) { } -zen::AssertException::~AssertException() +AssertException::~AssertException() { } @@ -101,3 +103,5 @@ zencore_forcelinktests() zen::usonbuilder_forcelink(); zen::usonpackage_forcelink(); } + +} // namespace zen |