\doxysection{Fancy\+Lock.\+hpp}
\hypertarget{FancyLock_8hpp_source}{}\label{FancyLock_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Util/FancyLock.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Util/FancyLock.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_UTIL\_FANCYLOCK\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_UTIL\_FANCYLOCK\_H}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <mutex>}}
\DoxyCodeLine{00005\ }
\DoxyCodeLine{00006\ \textcolor{comment}{//\ I\ really\ want\ to\ be\ able\ to\ write\ WITH\_LOCK(...)\ \{\ \}}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{keyword}{struct\ }fancy\_lock\_guard}
\DoxyCodeLine{00009\ \{}
\DoxyCodeLine{00010\ \ \ \ \ fancy\_lock\_guard(std::mutex\ \&mutex)\ :\ \_lock(mutex)\ \{\ \}}
\DoxyCodeLine{00011\ \ \ \ \ std::lock\_guard<std::mutex>\ \_lock;}
\DoxyCodeLine{00012\ \ \ \ \ \textcolor{keyword}{operator}\ bool()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};\ \}}
\DoxyCodeLine{00013\ \};}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#define\ WITH\_LOCKGUARD(m)\ if\ (auto\ \_\_lock\ =\ fancy\_lock\_guard(m))}}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_UTIL\_FANCYLOCK\_H}}

\end{DoxyCode}
