diff options
-rw-r--r-- | tour3_log/tour3_log.tex | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tour3_log/tour3_log.tex b/tour3_log/tour3_log.tex index b512b44..98cc769 100644 --- a/tour3_log/tour3_log.tex +++ b/tour3_log/tour3_log.tex @@ -118,4 +118,35 @@ What does the comma operator usually do? Would it be possible to have \texttt{a} and \texttt{b} interact through the comma operator when supplied as parameters to a function \texttt{func(a,b)}? +\section*{Chapter 18: Concurrency} +%Would using a std::atomic<bool> for stopping threads result in +%problems, compared to +%using \texttt{std::stop\_source}/\texttt{std::stop\_token}? +%\begin{verbatim} +%void thread_func(std::atomic<bool>& running) +%{ +% while(running.load()) +% { +% // do something useful +% } +%} +% +%int main() +%{ +% std::atomic<bool> running{true}; +% std::thread t([&](){ thread_func(running); }); +% +% // do stuff +% +% running.store(false); // request to stop +% t.join(); +%} +%\end{verbatim} +% +%\bigskip + +It is mentioned that coroutines can execute in parallel. Is this when +used alongside for example \texttt{std::async}? +It would be interesting to see an example of this? + \end{document} |