Skip to content

Commit bdf1685

Browse files
author
Vladimir Kotal
committed
add cleanup example
1 parent b822653 commit bdf1685

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

threads.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,14 @@
589589
\label{PTHREAD_CLEANUP}
590590

591591
\begin{itemize}
592-
\item Cleanup functions are called as \texttt{routine(arg)}.
592+
\item The cleanup function is called as \texttt{routine(arg)}.
593+
\item The \funnm{pthread\_cleanup\_push} and \funnm{pthread\_cleanup\_pop}
594+
functions provide sort of a bracketing around code block that might need a
595+
cleanup. In fact, more often than not these functions are implemented as macros
596+
that open and close code blocks. This enforces this usage pattern
597+
(and causes trouble with \texttt{goto} statements).
598+
\item Run a C preprocessor on \example{pthreads/pthread-create.c} and see how
599+
this is done.
593600
\end{itemize}
594601

595602
%%%%%

0 commit comments

Comments
 (0)