Last active
August 9, 2021 15:58
-
-
Save picanumber/094a17852916e536b69fcaf1ec147b16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T> class Locking | |
{ | |
T _data; | |
mutable std::recursive_mutex _mtx; | |
/* Define call proxy here */ | |
public: | |
template <class U> Locking(U &&data) : _data(std::forward<U>(data)) | |
{ | |
} | |
CallProxy<T> operator->() | |
{ | |
_mtx.lock(); | |
return CallProxy<T>(&_data, _mtx); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment