utx::raii_lock is a RAII-only lock template class for a mutex. Its usage is similar to std::lock_guard.
utx::raii_lock is designed for utx::print firstly, but it can be used for general purpose.
Calling Sig:
std::mutex mutex; { utx::raii_lock<std::mutex> lock{mutex}; } // Auto-unlock when leaving this scope.
#include <utxcpp/core.hpp> #include <future> int main() { std::mutex mutex; auto f = std::async( [&mutex] { utx::raii_lock<std::mutex> lock{mutex}; std::cout << "Hello c++!" << std::endl; } ); utx::print(mutex, "Hello c++ by", "utx::print!"); }