[*] Further compress
This commit is contained in:
parent
82d455c4b1
commit
8272959249
@ -13,9 +13,9 @@ namespace Aurora::Threading::Primitives
|
||||
|
||||
static const auto kPrimitiveSizeNTMutex = 16;
|
||||
static const auto kPrimitiveSizeNTSemaphore = 64;
|
||||
static const auto kPrimitiveSizeNTCS = 40;
|
||||
static const auto kPrimitiveSizeNTCS = 32;
|
||||
static const auto kPrimitiveSizeNTEvent = 64;
|
||||
static const auto kPrimitiveSizeNTRWLock = 112;
|
||||
static const auto kPrimitiveSizeNTRWLock = 104;
|
||||
static const auto kPrimitiveSizeNTCond = 32;
|
||||
static const auto kPrimitiveSizeNTCondMutex = 16;
|
||||
|
||||
|
@ -16,13 +16,13 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex);
|
||||
|
||||
AuSPtr<IConditionMutex> GetMutex() override;
|
||||
bool WaitForSignal(AuUInt32 timeout) override;
|
||||
bool WaitForSignalNS(AuUInt64 qwTimeout);
|
||||
void Signal() override;
|
||||
void Broadcast() override;
|
||||
auline AuSPtr<IConditionMutex> GetMutex() override;
|
||||
auline bool WaitForSignal(AuUInt32 timeout) override;
|
||||
auline bool WaitForSignalNS(AuUInt64 qwTimeout);
|
||||
auline void Signal() override;
|
||||
auline void Broadcast() override;
|
||||
|
||||
bool CheckOut(bool &bRet);
|
||||
auline bool CheckOut(bool &bRet);
|
||||
|
||||
private:
|
||||
#if defined(AURORA_FORCE_SRW_LOCKS)
|
||||
@ -32,11 +32,7 @@ namespace Aurora::Threading::Primitives
|
||||
AuUInt32 signalCount {};
|
||||
#endif
|
||||
|
||||
#if defined(AU_CFG_ID_DEBUG) || defined(AU_CFG_ID_INTERNAL)
|
||||
std::shared_ptr<Win32ConditionMutex> mutex_;
|
||||
#else
|
||||
AuSPtr<Win32ConditionMutex> mutex_;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
#endif
|
@ -82,7 +82,8 @@ namespace Aurora::Threading::Primitives
|
||||
ConditionMutexImpl mutex_;
|
||||
ConditionVariableImpl condition_;
|
||||
volatile AuInt32 state_ {};
|
||||
AuInt32 writersPending_ {};
|
||||
bool bElevaterPending_ {};
|
||||
AuInt32 writersPending_ : 31 {};
|
||||
AuInt32 bElevaterPending_ : 1 {};
|
||||
//bool bElevaterPending_{};
|
||||
};
|
||||
}
|
||||
|
@ -16,7 +16,11 @@ extern "C"
|
||||
|
||||
namespace Aurora::Threading::Primitives
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
using ThreadCookie_t = AuUInt32; // nt optimization: always use non-pointers (thread ids) as cookies
|
||||
#else
|
||||
using ThreadCookie_t = AuUInt;
|
||||
#endif
|
||||
|
||||
static auline ThreadCookie_t GetThreadCookie()
|
||||
{
|
||||
@ -31,9 +35,20 @@ namespace Aurora::Threading::Primitives
|
||||
return ::GetCurrentThreadIDFast();
|
||||
#endif
|
||||
#elif defined(AURORA_IS_POSIX_DERIVED)
|
||||
// pthread_self is usually a c-friendly a macro in a header that reads from a segment
|
||||
// though the result is always a pointer wide
|
||||
// this should be faster than the worst case of syscall wrappers of nonstandard get thread id of whatever family of os
|
||||
// example: https://elixir.bootlin.com/musl/v1.1.1/source/arch/arm/pthread_arch.h#L14
|
||||
// https://elixir.bootlin.com/musl/v1.1.1/source/arch/x32/pthread_arch.h#L1
|
||||
// powermac segment? https://github.com/phracker/MacOSX-SDKs/blob/041600eda65c6a668f66cb7d56b7d1da3e8bcc93/MacOSX10.3.0.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/ppc/cpu_capabilities.h#L142
|
||||
// modern mac? https://github.com/apple/darwin-libpthread/blob/2b46cbcc56ba33791296cd9714b2c90dae185ec7/src/pthread.c#L891
|
||||
// x86_32 darwin? movl %gs:0x0, %edx https://github.com/apple/darwin-libpthread/blob/2b46cbcc56ba33791296cd9714b2c90dae185ec7/src/pthread_asm.s#L162
|
||||
// glibc is just slow nested c cancer
|
||||
// exactly what youd expect at peak freetard
|
||||
// wont be our problem when we start linking against muslc to get away from their crap
|
||||
return (ThreadCookie_t)pthread_self();
|
||||
#else
|
||||
return (ThreadCookie_t)Threads::GetThread();
|
||||
return (ThreadCookie_t)Threads::GetThreadId();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user