ost::ThreadLock(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

πŸ’– ost::ThreadLock β€” from the Library Functions Manual, section 3 πŸ’–

okay bestie, sit down, we're doing a whole class today. this is ost::ThreadLock and she's literally the moment. no cap.


✨ NAME ✨

ost::ThreadLock β€” the ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have rwlock support, and reverts to a simple mutex for those that do not.

(yes, 'impliments'. that's the original spelling and I am NOT touching it, it's part of the lore 🫢)


🌸 SYNOPSIS 🌸

#include <thread.h>

πŸŽ€ Public Member Functions

  • ThreadLock () β€” Create a process shared thread lock object.
  • virtual ~ThreadLock () β€” Destroy a process shared thread lock object.
  • void readLock (void) β€” Aquire a read lock for the current object.
  • void writeLock (void) β€” Aquire a write lock for the current object.
  • bool tryReadLock (void) β€” Attempt read lock for current object.
  • bool tryWriteLock (void) β€” Attempt write lock for current object.
  • void unlock (void) β€” Release any held locks.

πŸ’œ Detailed Description πŸ’œ

The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have rwlock support, and reverts to a simple mutex for those that do not.

so like. if your system has rwlock support, readers get the VIP treatment, everyone can read at once, it's giving main character energy. and if your system doesn't have rwlock support? she doesn't panic, she just quietly falls back to a plain old mutex. adaptable queen πŸ‘‘

Author

  • David Sugar dyfet@ostel.com

Posix rwlock extension for protected access.


πŸ¦‹ Constructor & Destructor Documentation πŸ¦‹

ost::ThreadLock::ThreadLock ()

Create a process shared thread lock object.

virtual ost::ThreadLock::~ThreadLock () [virtual]

Destroy a process shared thread lock object.


🌈 Member Function Documentation 🌈

void ost::ThreadLock::readLock (void)

Aquire a read lock for the current object.

Referenced by ost::ReadLock::ReadLock().

bool ost::ThreadLock::tryReadLock (void)

Attempt read lock for current object.

Returns

  • true on success.

bool ost::ThreadLock::tryWriteLock (void)

Attempt write lock for current object.

Returns

  • true on success.

void ost::ThreadLock::unlock (void)

Release any held locks.

Referenced by ost::ReadLock::~ReadLock(), and ost::WriteLock::~WriteLock().

void ost::ThreadLock::writeLock (void)

Aquire a write lock for the current object.

Referenced by ost::WriteLock::WriteLock().

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for GNU CommonC++ from the source code.


and that's the whole page, bestie πŸ’… this one came to you from GNU CommonC++, generated automatically by Doxygen from the source code, dated Sun Dec 27 2020 β€” so it's vintage, it's iconic, it's ost::ThreadLock(3). go lock something safely, mwah πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from