Reece
e5e36bd887
[*] Fix deadlock in the async subsystem (NoLockShutdown vs Shutdown in exception handler) [+] Added ProccessMap NT variant [+] Added ToolHelp image profiling [*] Improved exception awareness [*] Delegated SpawnThread to isolated TU, ready for reuse for RunAs and XNU Open - now with horrible evil alloc that could fail [+] Added header for future api 'UtilRun' [*] Improve NT core detection [*] Changed small affinity bitmap to AuUInt64 instead of AuUInt32 [+] Added data structure to hold cpuids/affinity masks [+] Implemented logger sinks [+] Implemented logger glue logic [*] Began migrating older loggers to sink-based default devices [*] Minor refactors [*] Improved internal exception discarding, not yet nothrow capable [*] Minor create directory fix
42 lines
979 B
C++
42 lines
979 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: LSSemaphore.NT.cpp
|
|
Date: 2021-10-1
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "LSSemaphore.hpp"
|
|
|
|
namespace Aurora::Loop
|
|
{
|
|
bool Semaphore::AddOne()
|
|
{
|
|
LONG atomicOld;
|
|
return ReleaseSemaphore(reinterpret_cast<HANDLE>(handle), 1, &atomicOld);
|
|
}
|
|
|
|
bool Semaphore::IsSignaled()
|
|
{
|
|
return LSHandle::IsSignaled();
|
|
}
|
|
|
|
ELoopSource Semaphore::GetType()
|
|
{
|
|
return ELoopSource::eSourceSemaphore;
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphore(AuUInt32 initialCount)
|
|
{
|
|
AuSPtr<Semaphore> ret;
|
|
|
|
auto mutex = CreateSemaphoreA(NULL, initialCount, std::numeric_limits<LONG>::max(), NULL);
|
|
if (mutex == INVALID_HANDLE_VALUE)
|
|
{
|
|
SysPushErrorGen("Out of OS resources?");
|
|
return {};
|
|
}
|
|
|
|
return AuMakeShared<Semaphore>(mutex);
|
|
}
|
|
} |