AuroraRuntime/Include/Aurora/Threading
Jamie Reece Wilson d520b0ce42 [*] I'm going to let the reference waitaible/woa/futex primitives be copy and movable now.
condvars -> cannot matter, you're creating a new object
mutex -> cannot mater, you're creating a new object, perhaps copy assignment under lock might be required depending on the parent. either way, a copy ctor is not required
semaphore -> copy state in case of the timelime barrier use case. semaphores emulating condvars and similar logic wont mind the overshoot. best case, we do want to copy the previous state as the initial count. worst case, your code is fundamentally broken.
2024-05-28 00:42:24 +01:00
..
Primitives [*] d589ce3549 missed header update 2024-05-11 18:51:16 +01:00
Threads [*] Refactor IAuroraThread 2024-05-27 13:28:57 +01:00
Waitables [*] I'm going to let the reference waitaible/woa/futex primitives be copy and movable now. 2024-05-28 00:42:24 +01:00
InitOnce.hpp [*] Minor include header improvements 2023-09-22 00:46:51 +01:00
IWaitable.hpp [*] Ehhh. I never liked how I implemented the fallback for MS absolute waits. 2023-09-12 17:10:51 +01:00
LockGuard.hpp [*] MSVC isn't always inlining lock guards 2023-09-19 02:49:48 +01:00
LockGuardTry.hpp [*] A patch to fix some of the regressions introduced in the first step in overhauling AuAsync 2023-06-07 20:35:31 +01:00
README SleepNote.txt [+] NS readmes 2022-06-12 18:28:51 +01:00
README.md [*] Updated/added FutexBarrier comments and updated AuThreadings README 2024-05-27 14:35:10 +01:00
Sleep.hpp Initial Commit 2021-06-27 22:25:29 +01:00
SpinTime.hpp [*] Cleanup/formatting of SMT yields 2023-09-06 17:01:01 +01:00
Threading.hpp [+] AuInitOnce 2023-09-17 13:26:37 +01:00
WaitFor.hpp [*] Updated AuTheading::WaitFor prototype 2024-05-27 15:04:21 +01:00
WakeOnAddress.hpp [*] Updated WakeOnAddress comments 2024-03-13 09:37:07 +00:00

AuThreading

Features

  • Thread synchronization primitives: condition ex, condition mutex, condition variable, critical section, event, mutex, rwlock, semaphore, and spinlock
  • All primitives include a trylock and a nanosecond-resolution timed lock methods
  • All lock-like primitives can be used with a AuFlexibleConditionVariable (noting AuConditionVariable binds to a single AuCondMutex)
  • WakeOnAddress support on every operating system regardless of kernel support
  • WakeOnAddress with various wake operations (eNotEqual, eEqual, eLessThanCompare, eGreaterThanCompare, eLessThanOrEqualsCompare, eGreaterThanOrEqualsCompare) of any size under 32 bytes
  • Reference futex primitives: AuInitOnce, AuInitOnceSmall, AuFutexBarrier, AuFutexCond, AuFutexMutex, AuFutexSemaphore, FutexWaitable*NoVTbl**Movable*Smallest (AuFutexMutexSmallest)
  • No primitive will ever waste time syscalling or otherwise waking if not required
  • Single core (thread check), Intel SMT (rdtsc), AARCH64 (rdtsc emu via CNTVCT_EL0), Intel Alderlake (umonitor/tpause), and AMD 2016+ (monitorx) optimized/aware spinning optimizations with in-process and CPU heuristics
  • ...known good performance and low kernel stated CPU usage% on Windows 7, Windows 11, and Linux spanning a diverse range of processors.
  • Timeline semaphores / completion barriers are supported via AuFutexSemaphore::LockUntilAtleastAbsNS/AcquireUntilAtleastAbsNS
  • RWLock supports read-to-write upgrades when the decision to esclate is made based upon a shared resource, plus CheckSelfThreadIsWriter check
  • RWLocks are read criticial section based and all writer threads are allowed to enter read critical sections. In addition, AuRWRenterableLock allows for write reentrancy.
  • Enchanced Win32 support with increased yield resolution and optimization around internal XP, internal Win8, and UWP APIs
  • SleepNs function supporting higher resolution sleep available than in most APIs (^1)
  • Thread Object per native OS thread
  • Thread spawning with TLS handles and shutdown routines ~~dispatched under pseudo fibers. TODO: reimpl thread 'features' and NT-like APCs ~~
  • Update thread affinity, throttle, name, and related attributes
  • Lock Util: AU_LOCK_GUARD(pointer/reference/shared ptr)
  • Lock Util: AU_TRY_LOCK_GUARD[...](pointer/reference/shared ptr)

^1: README SleepNote.txt