Skip to content

Commit 3d8fe9c

Browse files
author
Vladimir Kotal
committed
more explanation of pthread_once
1 parent f8cb68e commit 3d8fe9c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

threads.tex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,14 @@
422422
\end{slide}
423423

424424
\begin{itemize}
425-
\item In the program itself you probably will not need this function. You can
425+
\item In program itself you will probably not need this function. You can
426426
just call the initialization function before you create the first thread.
427427
\item It is undefined if \emph{once\_control} is a local variable or does not
428428
have an expected value.
429+
\item This is handy for lazy initialization, i.e. only after one of the threads
430+
call into APIs of the library (as opposed to when the library is being loaded),
431+
the library becomes initialized and the semantics of \texttt{pthread\_once}
432+
will make sure this will happen only once.
429433
\end{itemize}
430434

431435
%%%%%

0 commit comments

Comments
 (0)