X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=thread.tex;h=62f4dfdf7e9bc388c02835965d9a36b120d6c0d5;hp=6dce4cc19587a106d79e5cab679e8237f6ebc3c8;hb=26f7a8bb19c6cb198c213757a97b6ac79e40db4b;hpb=9b4e35959dc9df4830ce828e462893d4a776ced9 diff --git a/thread.tex b/thread.tex index 6dce4cc..62f4dfd 100644 --- a/thread.tex +++ b/thread.tex @@ -1,6 +1,6 @@ %% thread.tex %% -%% Copyright (C) 2007-2018 Simone Piccardi. Permission is granted to +%% Copyright (C) 2007-2019 Simone Piccardi. Permission is granted to %% copy, distribute and/or modify this document under the terms of the GNU Free %% Documentation License, Version 1.1 or any later version published by the %% Free Software Foundation; with the Invariant Sections being "Un preambolo", @@ -116,6 +116,24 @@ della \acr{glibc}. \label{sec:pthread_management} +Benché la funzione sia utilizzabile anche con i processi, tanto che a partire +dalla versione 2.3 della \acr{glibc} viene a sostituire \func{\_exit} (tramite +un \textit{wrapper} che la utilizza al suo posto) per la terminazione di tutti +i \textit{thread} di un processo si deve usare la funzione di sistema +\func{exit\_group}, il cui prototipo è: + +\begin{funcproto}{ +\fhead{linux/unistd.h} +\fdecl{void exit\_group(int status)} +\fdesc{Termina tutti i \textit{thread} di un processo.} +} +{La funzione non ha errori e pertanto non ritorna.} +\end{funcproto} + +La funzione è sostanzialmente identica alla \textit{system call} \func{\_exit} +ma a differenza di quest'ultima, che termina solo il \textit{thread} +chiamante, termina tutti \textit{thread} del processo. + \section{La sincronizzazione dei \textit{thread}} \label{sec:pthread_sync}