This release extends the threading API for reader/writer lock support that allow uncontended read locks for excellent speed and scalability. Shared lock performance should scale linearly. Exclusive lock performance is expected to be slower than alternatives.
NINT ctThrdSharedCriticalInit(ctSCRIT * scrit)
Initializes the shared critical pointed to by scrit.
Returns 0 on success.
NINT ctThrdSharedCriticalEnter(ctSCRIT * scrit, volatile RESERVATION * ticket)
A shared lock of scrit. Each calling thread must have a unique RESERVATION they provide to each scrit. There are multiple restrictions on ticket:
Behavior is undefined if called recursively.
Waits indefinitely if an Exclusive lock is in effect.
Note: False sharing of RESERVATION memory could impact scalability.
Returns 0 on success.
NINT ctThrdSharedCriticalExit(ctSCRIT * scrit, volatile RESERVATION * ticket)
Releases the shared lock of scrit. The same ticket passed by this thread to ctThrdSharedCriticalEnter must be used.
Returns 0 on success.
NINT ctThrdSharedCriticalCancelReservation(ctSCRIT * scrit, volatile RESERVATION * ticket)
Releases resources in scrit associated with ticket. This must be called prior to thread exit once a particular ticket has been passed to ctThrdSharedCriticalEnter.
Returns 0 on success.
NINT ctThrdSharedCriticalEnterExcl(ctSCRIT * scrit)
An exclusive lock of scrit. Behavior is undefined if called recursively.
Returns 0 on success.
NINT ctThrdSharedCriticalExitExcl(ctSCRIT * scrit)
Releases an exclusive lock of scrit.
Returns 0 on success.
NINT ctThrdSharedCriticalTerm(ctSCRIT * scrit)
Releases resources used by shared critical. Behavior is undefined if scrit is still in use by other threads.