Translations:Pthreads/8/fr: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(Created page with "Le moyen le plus simple et le plus utilisé pour contrôler l'accès concurrent est le [https://fr.wikipedia.org/wiki/Verrou_(informatique) verrou]; dans le contexte de pthrea...")
 
No edit summary
Line 1: Line 1:
Le moyen le plus simple et le plus utilisé pour contrôler l'accès concurrent est le [https://fr.wikipedia.org/wiki/Verrou_(informatique) verrou]; dans le contexte de pthreads,  le mécanisme de verrouillage est le mutex (pour ''mutual exclusion'').
Le moyen le plus simple et le plus utilisé pour contrôler l'accès concurrent est le [https://fr.wikipedia.org/wiki/Verrou_(informatique) verrou]; dans le contexte de pthreads,  le mécanisme de verrouillage est le mutex (pour ''mutual exclusion'').
In pthreads, a mutex is a kind of variable that may be "locked" or "owned" by only one thread at a time. The thread must then release or unlock the mutex once the global data has been read or modified. The code that lies between the call to lock a mutex and the call to unlock it will only be executed by a single thread at a time. To create a mutex in a pthreads program, we declare a global variable of type <tt>pthread_mutex_t</tt> which must be initialized before it is used by calling <tt>[http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutex_init.html pthread_mutex_init]</tt>. At the program's end we release the resources associated with the mutex by calling <tt>[http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutex_init.html pthread_mutex_destroy]</tt>.

Revision as of 16:49, 10 January 2017

Information about message (contribute)
This message has no documentation. If you know where or how this message is used, you can help other translators by adding documentation to this message.
Message definition (Pthreads)
The simplest and most common way to control the reading and writing of data shared among threads is the [https://en.wikipedia.org/wiki/Lock_(computer_science) mutex], derived from the expression 'mutual exclusion'. In pthreads, a mutex is a kind of variable that may be "locked" or "owned" by only one thread at a time. The thread must then release or unlock the mutex once the global data has been read or modified. The code that lies between the call to lock a mutex and the call to unlock it will only be executed by a single thread at a time. To create a mutex in a pthreads program, we declare a global variable of type <tt>pthread_mutex_t</tt> which must be initialized before it is used by calling <tt>[http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutex_init.html pthread_mutex_init]</tt>. At the program's end we release the resources associated with the mutex by calling <tt>[http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutex_init.html pthread_mutex_destroy]</tt>.

Le moyen le plus simple et le plus utilisé pour contrôler l'accès concurrent est le verrou; dans le contexte de pthreads, le mécanisme de verrouillage est le mutex (pour mutual exclusion). In pthreads, a mutex is a kind of variable that may be "locked" or "owned" by only one thread at a time. The thread must then release or unlock the mutex once the global data has been read or modified. The code that lies between the call to lock a mutex and the call to unlock it will only be executed by a single thread at a time. To create a mutex in a pthreads program, we declare a global variable of type pthread_mutex_t which must be initialized before it is used by calling pthread_mutex_init. At the program's end we release the resources associated with the mutex by calling pthread_mutex_destroy.