ost::ReadLock(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

πŸ’– ost::ReadLock πŸ’–

okay bestie, so this one is a Library Functions Manual page from GNU CommonC++ and it's about ost::ReadLock β€” literally the cutest little guard for your code πŸ’…


✨ NAME ✨

ost::ReadLock β€” the ReadLock class is used to protect a section of code through a ThreadLock for 'read' access to the member function. 🫢


🌸 SYNOPSIS 🌸

#include <thread.h>

πŸŽ€ Public Member Functions

  • ReadLock (ThreadLock &_tl) β€” wait for read access, babe. you just sit there and wait for your turn ✨
  • ~ReadLock () β€” posts the semaphore automatically when it dips. no manual cleanup, we love a self-sufficient icon πŸ‘‘

πŸ¦‹ Detailed Description πŸ¦‹

So the ReadLock class is used to protect a section of code through a ThreadLock for 'read' access to the member function. periodt. πŸ’…

And the absolute slay of it all: the ThreadLock is automatically released when the object falls out of scope. you don't have to do anything, it just handles itself. main character energy fr fr 🌈

A common use is

void func_to_protect() { ReadLock lock(threadlock); ... operation ... }
⚠️ NOTE: do not declare variable as 'ReadLock (threadlock)' β€” the mutex will be released at statement end. bestie I am BEGGING you, don't do it 😭 that's not the vibe. that's the opposite of the vibe. πŸ’€

🌟 Author

David Sugar dyfet@gnu.org

Read mode automatic locker for protected access. it's giving safety, it's giving elegance, it's giving "my code can't get corrupted by a rogue thread" 🧚


πŸ’œ Constructor & Destructor Documentation πŸ’œ

πŸ“ ost::ReadLock::ReadLock (ThreadLock & _tl) [inline]

Wait for read access. that's it. that's the whole job. iconic. ✨

Parameters

  • _tl β€” reference to lock to aquire.

References ost::ThreadLock::readLock().


πŸ“ ost::ReadLock::~ReadLock () [inline]

Post the semaphore automatically. it cleans up after itself like a well-raised queen πŸ‘‘

References ost::ThreadLock::unlock().


πŸ‘‘ Author

Generated automatically by Doxygen for GNU CommonC++ from the source code. (not me writing it by hand, the robots did that part πŸ€–)


and that's the whole page bestie!! this was GNU CommonC++, dated Sun Dec 27 2020, and yeah the title really is ost::ReadLock(3) β€” now go forth and lock your reads responsibly, ily πŸ’–πŸŒΈπŸ¦‹βœ¨πŸŽ€πŸ’…πŸ«Ά

πŸ“¦ where this page comes from