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:
you can also make the Unlocker const so you can only access const members of C
anyway I'm proud of this C:
there is a wrinkle because there is no copy constructor since std::mutex has no copy constructor, but you could potentially get around this by wrapping the mutex in a std::shared_ptr
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.