ost::WriteLock(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

πŸ’– ost::WriteLock β€” from the ost C++ library (section 3, Library Functions Manual) πŸ’–


✨ NAME ✨

ost::WriteLock β€” the class that guards a chunk of your code through a ThreadLock, giving you 'write' access to the member function. it's giving bodyguard energy fr 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <thread.h>

🌸 Public Member Functions 🌸

  • WriteLock (ThreadLock &_tl) β€” wait for write access ⏳
  • ~WriteLock () β€” post the semaphore automatically, no manual cleanup bestie πŸ’…

πŸ‘‘ Detailed Description πŸ‘‘

okay so here's the whole vibe: the WriteLock class protects a section of your code through a ThreadLock, and it's doing it for 'write' access to the member function. she's exclusive, she's committed, she's not sharing πŸ’œ

the ThreadLock is automatically released when the object falls out of scope. like, she cleans up after herself without you even asking. iconic behaviour, truly. ✨

a common use is:

void func_to_protect() { WriteLock lock(threadlock); ... operation ... }
🚨 NOTE: do not declare the variable as 'WriteLock (threadlock)' β€” the mutex will be released at statement end. like, the lock will dip immediately and your protection is GONE. do not do this. i am begging. 😭

Author David Sugar dyfet@gnu.org πŸ’Œ

Read mode automatic locker for protected access.


🧚 Constructor & Destructor Documentation 🧚

πŸ’« ost::WriteLock::WriteLock (ThreadLock & _tl) [inline] πŸ’«

wait for write access. she's waiting her turn, patiently, like a main character. ⭐

Parameters

  • _tl β€” reference to threadlock to aquire.

References ost::ThreadLock::writeLock().


πŸ’« ost::WriteLock::~WriteLock () [inline] πŸ’«

post the semaphore automatically. no manual release needed, she handles it on her way out. periodt. πŸŽ€

References ost::ThreadLock::unlock().


πŸ’œ Author πŸ’œ

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


and that's the whole page bestie!! this lil number lives in the GNU CommonC++ collection, and the version/date on the tin says Sun Dec 27 2020 β€” ost::WriteLock(3), that's a wrap, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from