I made a class in C++ today and I'm surprised it's not something that was already in the standard library
basically it's a class called LockBox<C> that holds an instance of C which is inaccessible, unless you use the Unlocker<C> class like so:
*pass box around to different threads*
*later in some thread*
and it's thread safe C:
@SuricrasiaOnline so it's kinda like rust's idea of mutexes?
I like this, and agree, why the heck isn't it in std
@k thankfully it's not too difficult to implement yourself, you just need to piece together std::mutex and std::lock_guard together in a particular way
Cybrespace is an instance of Mastodon, a social network based on open web protocols and free, open-source software. It is decentralized like e-mail.