summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2023-07-26 16:37:13 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2023-07-26 16:37:13 +0200
commit05d1646c07d256937a8886094a94ed0071415ded (patch)
tree768b014c055b24ac10ca96ec76e3f70f892f83e9
parent3cf89e5137ea333e81c2d62716054848ea8e4be5 (diff)
Tour3Log: Chapter 18
-rw-r--r--tour3_log/tour3_log.tex31
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}