Pthreads
Contains Arabic or Urdu scriptContains Hiragana or Katakana script
SHA-256b4e9ea76754d97264458e7746e7c5745e2c6a89c258e48929ad1b31206dff4e2
MaleculeO(As)H₂(DbPo)Md
Evidence
1<!DOCTYPE html>
2<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-menu-disabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 skin-theme-clientpref-day vector-feature-navigation-update-disabled vector-sticky-header-enabled vector-toc-available skin-thumbsize-clientpref-standard" lang="en" dir="ltr">
3<head>
4<meta charset="UTF-8">
5<title>pthreads - Wikipedia</title>
6<script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-menu-disabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 skin-theme-clientpref-day vector-feature-navigation-update-disabled vector-sticky-header-enabled vector-toc-available skin-thumbsize-clientpref-standard";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",
7RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.wikimediamessages.styles":"ready","ext.pygments":"ready","ext.cite.parsoid.styles":"ready","ext.cite.styles":"ready","mediawiki.skinning.content.parsoid":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready"};RLPAGEMODULES=["ext.pygments.view","ext.cite.ux-enhancements","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","ext.testKitchen","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.echo.centralaut
8<script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"});
9}];});});</script>
10<link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.parsoid.styles%7Cext.cite.styles%7Cext.pygments%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cmediawiki.skinning.content.parsoid%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022">
11<script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script>
12<meta name="ResourceLoaderDynamicStyles" content="">
26<link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)">
27<link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd">
28<link rel="canonical" href="https://en.wikipedia.org/wiki/Pthreads">
29<link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">
30<link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom">
31<link rel="dns-prefetch" href="//meta.wikimedia.org" />
32<link rel="dns-prefetch" href="auth.wikimedia.org">
183 </nav>
184
185<div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" >
186 <div class="vector-menu-content">
187
666<div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr" typeof="mw:Extension/syntaxhighlight" about="#mwt14" id="mwUg" data-mw='{"name":"syntaxhighlight","attrs":{"lang":"c"},"body":{"extsrc":"\n#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <pthread.h>\n#include <unistd.h>\n\n#define NUM_THREADS 5\n\nvoid* perform_work(void* arguments){\n int index = *((int*)arguments);\n int sleep_time = 1 + rand() % NUM_THREADS;\n printf(\"Thread %d: Started.\\n\", index);\n printf(\"Thread %d: Will be sleeping for %d seconds.\\n\", index, sleep_time);\n sleep(sleep_time);\n printf(\"Thread %d: Ended.\\n\", index);\n return NULL;\n}\n\nint main(void) {\n pthread_t threads[NUM_THREADS];\n int thread_args[NUM_THREADS];\n int result_code;\n \n //create all threads one by one\n for (int i = 0; i < NUM_THREADS; i++) {\n printf(\"In main: Creating thread %d.\\n\", i);\n thread_args[i] = i;\n result_code = pthread_cr
667<span class="cp" id="mwWA">#include</span><span class="w" id="mwWQ"> </span><span class="cpf" id="mwWg"><stdio.h></span>
668<span class="cp" id="mwWw">#include</span><span class="w" id="mwXA"> </span><span class="cpf" id="mwXQ"><stdlib.h></span>
775</section><section data-mw-section-id="6" id="mwAg4" aria-labelledby="Further_reading"><div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Pthreads&action=edit&section=6" title="Edit section: Further reading"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div>
776<ul id="mwAg8"><li id="mwAhA"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1333433106" about="#mwt28" typeof="mw:Extension/templatestyles mw:Transclusion" id="mwAhE" data-mw='{"name":"templatestyles","attrs":{"src":"Module:Citation/CS1/styles.css"},"body":{"extsrc":""},"parts":[{"template":{"target":{"wt":"cite book ","href":"./Template:Cite_book"},"params":{"author":{"wt":"David R. Butenhof"},"title":{"wt":"Programming with POSIX Threads"},"publisher":{"wt":"Addison-Wesley"},"isbn":{"wt":"978-0-201-63392-4"},"year":{"wt":"1997"}},"i":0}}]}'/><cite id="CITEREFDavid_R._Butenhof1997" class="citation book cs1" about="#mwt28">David R. Butenhof (1997). <i>Programming with POSIX Threads</i>. Addison-Wesley. <a rel="mw:WikiLink" href="//en.wikipedia.org/wiki/ISBN_(identifier)" title="ISBN (identifier)" class="mw-redirect">ISBN</a><span typeof="mw:Entity"> </span><a rel="mw:WikiLink" href="//en.wikipedia.org/wiki/Special:BookSources/978-0-201-63392-4" title="Special:BookSources/978-0-201-63
777<li id="mwAhM"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1333433106" about="#mwt30" typeof="mw:Extension/templatestyles mw:Transclusion" id="mwAhQ" data-mw='{"name":"templatestyles","attrs":{"src":"Module:Citation/CS1/styles.css"},"body":{"extsrc":""},"parts":[{"template":{"target":{"wt":"cite book ","href":"./Template:Cite_book"},"params":{"author1":{"wt":"Bradford Nichols"},"author2":{"wt":"Dick Buttlar"},"author3":{"wt":"Jacqueline Proulx Farell"},"title":{"wt":"Pthreads Programming"},"publisher":{"wt":"O'Reilly & Associates"},"isbn":{"wt":"978-1-56592-115-3"},"date":{"wt":"September 1996"},"url-access":{"wt":"registration"},"url":{"wt":"https://archive.org/details/pthreadsprogramm00nich"}},"i":0}}]}'/><cite id="CITEREFBradford_NicholsDick_ButtlarJacqueline_Proulx_Farell1996" class="citation book cs1" about="#mwt30">Bradford Nichols; Dick Buttlar; Jacqueline Proulx Farell (September 1996). <span class="id-lock-registration" title="Free registration required"><a rel="mw
778<li id="mwAhY"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1333433106" about="#mwt32" typeof="mw:Extension/templatestyles mw:Transclusion" id="mwAhc" data-mw='{"name":"templatestyles","attrs":{"src":"Module:Citation/CS1/styles.css"},"body":{"extsrc":""},"parts":[{"template":{"target":{"wt":"cite book ","href":"./Template:Cite_book"},"params":{"author":{"wt":"Charles J. Northrup"},"title":{"wt":"Programming with UNIX Threads"},"publisher":{"wt":"John Wiley & Sons"},"isbn":{"wt":"978-0-471-13751-1"},"date":{"wt":"1996-01-25"},"url-access":{"wt":"registration"},"url":{"wt":"https://archive.org/details/programmingwithu0000nort"}},"i":0}}]}'/><cite id="CITEREFCharles_J._Northrup1996" class="citation book cs1" about="#mwt32">Charles J. Northrup (1996-01-25). <span class="id-lock-registration" title="Free registration required"><a rel="mw:ExtLink nofollow" href="https://archive.org/details/programmingwithu0000nort" class="external text"><i>Programming with UNIX Threads</i></a></span>.
779<li id="mwAhk"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1333433106" about="#mwt34" typeof="mw:Extension/templatestyles mw:Transclusion" id="mwAho" data-mw='{"name":"templatestyles","attrs":{"src":"Module:Citation/CS1/styles.css"},"body":{"extsrc":""},"parts":[{"template":{"target":{"wt":"cite book ","href":"./Template:Cite_book"},"params":{"author1":{"wt":"Kay A. Robbins"},"author2":{"wt":"Steven Robbins"},"name-list-style":{"wt":"amp"},"title":{"wt":"UNIX Systems Programming"},"publisher":{"wt":"Prentice-Hall"},"isbn":{"wt":"978-0-13-042411-2"},"year":{"wt":"2003"},"url-access":{"wt":"registration"},"url":{"wt":"https://archive.org/details/unixsystemsprogr0000robb"}},"i":0}}]}'/><cite id="CITEREFKay_A._RobbinsSteven_Robbins2003" class="citation book cs1" about="#mwt34">Kay A. Robbins & Steven Robbins (2003). <span class="id-lock-registration" title="Free registration required"><a rel="mw:ExtLink nofollow" href="https://archive.org/details/unixsystemsprogr0000robb" class="ex