38,789
edits
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 13: | Line 13: | ||
=Creation and Destruction of Pthreads= | =Creation and Destruction of Pthreads= | ||
When parallelizing an existing serial program using pthreads, we use a programming model where threads are created by a parent, then carry out some work, and finally are reabsorbed or joined back into the parent. The parent may be the serial ''master thread'' or another ''worker thread''. | When parallelizing an existing serial program using pthreads, we use a programming model where threads are created by a parent, then carry out some work, and finally are reabsorbed or joined back into the parent. The parent may be the serial ''master thread'' or another ''worker thread''. | ||
New threads are created with the function <tt>[http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_create.html pthread_create]</tt>. This function has four arguments: | |||
*the unique identifier for the newly created thread; | *the unique identifier for the newly created thread; | ||
*the set of attributes for this thread; | *the set of attributes for this thread; |