From 05d1646c07d256937a8886094a94ed0071415ded Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 26 Jul 2023 16:37:13 +0200 Subject: Tour3Log: Chapter 18 --- tour3_log/tour3_log.tex | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tour3_log/tour3_log.tex') 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 for stopping threads result in +%problems, compared to +%using \texttt{std::stop\_source}/\texttt{std::stop\_token}? +%\begin{verbatim} +%void thread_func(std::atomic& running) +%{ +% while(running.load()) +% { +% // do something useful +% } +%} +% +%int main() +%{ +% std::atomic 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} -- cgit v1.2.3