2 ms·
Even if very similar, I prefer the MutexedObj class described in those two articles https://fekir.info/post/extend-generic-thread-safe-mutexed_obj-class/ https
by franke2 3y ago
Even if very similar, I prefer the MutexedObj class described in those two articles
https://fekir.info/post/extend-generic-thread-safe-mutexed_obj-class/ https://fekir.info/post/extend-generic-thread-safe-mutexed_o...
https://fekir.info/post/sharing-data-between-threads/#_bind-the-data-and-mutex-together https://fekir.info/post/sharing-data-between-threads/#_bind-...
In particular it explains why providing getters or operator* like some other implementation do (not in this case) is not a feature, and it does not use multiple classes (like the linked implementation of SerenityOS does) making the implementation simpler.
Also the "simple" implementation is just 20 lines of code...