This file is indexed.

/usr/share/doc/racket/reference/threads.html is in racket-doc 6.7-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>11.1&nbsp;Threads</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="icons.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Reference</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="concurrency.html" class="tocviewselflink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18&nbsp;</td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9660;</a></td><td>11&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">11.1&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Threads</a></td></tr><tr><td align="right">11.2&nbsp;</td><td><a href="all-sync.html" class="tocviewlink" data-pltdoc="x">Synchronization</a></td></tr><tr><td align="right">11.3&nbsp;</td><td><a href="thread-local-storage.html" class="tocviewlink" data-pltdoc="x">Thread-<wbr></wbr>Local Storage</a></td></tr><tr><td align="right">11.4&nbsp;</td><td><a href="futures.html" class="tocviewlink" data-pltdoc="x">Futures</a></td></tr><tr><td align="right">11.5&nbsp;</td><td><a href="places.html" class="tocviewlink" data-pltdoc="x">Places</a></td></tr><tr><td align="right">11.6&nbsp;</td><td><a href="engine.html" class="tocviewlink" data-pltdoc="x">Engines</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_2&quot;);">&#9658;</a></td><td>11.1&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Threads</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">11.1.1&nbsp;</td><td><a href="#%28part._.Creating_.Threads%29" class="tocviewlink" data-pltdoc="x">Creating Threads</a></td></tr><tr><td align="right">11.1.2&nbsp;</td><td><a href="#%28part._threadkill%29" class="tocviewlink" data-pltdoc="x">Suspending, Resuming, and Killing Threads</a></td></tr><tr><td align="right">11.1.3&nbsp;</td><td><a href="#%28part._threadsync%29" class="tocviewlink" data-pltdoc="x">Synchronizing Thread State</a></td></tr><tr><td align="right">11.1.4&nbsp;</td><td><a href="#%28part._threadmbox%29" class="tocviewlink" data-pltdoc="x">Thread Mailboxes</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">11.1.1<tt>&nbsp;</tt></span><a href="#%28part._.Creating_.Threads%29" class="tocsubseclink" data-pltdoc="x">Creating Threads</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._current-thread%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">current-<wbr></wbr>thread</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread%2Fsuspend-to-kill%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread/<span class="mywbr"> &nbsp;</span>suspend-<wbr></wbr>to-<wbr></wbr>kill</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._call-in-nested-thread%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">call-<wbr></wbr>in-<wbr></wbr>nested-<wbr></wbr>thread</span></span></a></td></tr><tr><td><span class="tocsublinknumber">11.1.2<tt>&nbsp;</tt></span><a href="#%28part._threadkill%29" class="tocsubseclink" data-pltdoc="x">Suspending, Resuming, and Killing Threads</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>suspend</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>resume</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._kill-thread%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">kill-<wbr></wbr>thread</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._break-thread%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">break-<wbr></wbr>thread</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._sleep%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">sleep</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-running~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>running?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-dead~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>dead?</span></span></a></td></tr><tr><td><span class="tocsublinknumber">11.1.3<tt>&nbsp;</tt></span><a href="#%28part._threadsync%29" class="tocsubseclink" data-pltdoc="x">Synchronizing Thread State</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-wait%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>wait</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-dead-evt%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>dead-<wbr></wbr>evt</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume-evt%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>resume-<wbr></wbr>evt</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend-evt%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>suspend-<wbr></wbr>evt</span></span></a></td></tr><tr><td><span class="tocsublinknumber">11.1.4<tt>&nbsp;</tt></span><a href="#%28part._threadmbox%29" class="tocsubseclink" data-pltdoc="x">Thread Mailboxes</a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-send%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>send</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-receive%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>receive</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-try-receive%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>try-<wbr></wbr>receive</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-receive-evt%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>receive-<wbr></wbr>evt</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._thread-rewind-receive%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">thread-<wbr></wbr>rewind-<wbr></wbr>receive</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="concurrency.html" title="backward to &quot;11 Concurrency and Parallelism&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="concurrency.html" title="up to &quot;11 Concurrency and Parallelism&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="all-sync.html" title="forward to &quot;11.2 Synchronization&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;threads&quot;">11.1<tt>&nbsp;</tt><a name="(part._threads)"></a>Threads</h4><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="finger.png" alt="+" width="24" height="24"/></span><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&amp;rel=concurrency.html&amp;version=6.7" class="Sq" data-pltdoc="x">Concurrency and Synchronization</a> in <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&amp;rel=index.html&amp;version=6.7" class="Sq" data-pltdoc="x"><span style="font-weight: bold">The Racket Guide</span></a> introduces threads.</p></blockquote></blockquote></blockquote><p>See <a href="eval-model.html#%28part._thread-model%29" data-pltdoc="x">Threads</a> for basic information on the Racket
thread model. See also <a href="futures.html" data-pltdoc="x">Futures</a>.</p><p>When a thread is created, it is placed into the management of the
<a href="eval-model.html#%28tech._current._custodian%29" class="techoutside" data-pltdoc="x"><span class="techinside">current custodian</span></a> and added to the current <a href="threadgroups.html#%28tech._thread._group%29" class="techoutside" data-pltdoc="x"><span class="techinside">thread
group</span></a>. A thread can have any number of custodian managers added
through <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="RktValLink" data-pltdoc="x">thread-resume</a></span>.</p><p>A thread that has not terminated can be garbage collected (see
<a href="eval-model.html#%28part._gc-model%29" data-pltdoc="x">Garbage Collection</a>) if it is unreachable and suspended or if it is
unreachable and blocked on only unreachable events through functions
such as <span class="RktSym"><a href="semaphore.html#%28def._%28%28quote._~23~25kernel%29._semaphore-wait%29%29" class="RktValLink" data-pltdoc="x">semaphore-wait</a></span>, <span class="RktSym"><a href="semaphore.html#%28def._%28%28quote._~23~25kernel%29._semaphore-wait%2Fenable-break%29%29" class="RktValLink" data-pltdoc="x">semaphore-wait/enable-break</a></span>,
<span class="RktSym"><a href="channel.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._channel-put%29%29" class="RktValLink" data-pltdoc="x">channel-put</a></span>, <span class="RktSym"><a href="channel.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._channel-get%29%29" class="RktValLink" data-pltdoc="x">channel-get</a></span>, <span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._sync%29%29" class="RktValLink" data-pltdoc="x">sync</a></span>,
<span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._sync%2Fenable-break%29%29" class="RktValLink" data-pltdoc="x">sync/enable-break</a></span>, or <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-wait%29%29" class="RktValLink" data-pltdoc="x">thread-wait</a></span>. Beware, however,
of a limitation on <a href="places.html#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place-channel</span></a> blocking; see the
<a href="places.html#%28elem._%28caveat._place-channel-gc%29%29" data-pltdoc="x">caveat</a> in <a href="places.html" data-pltdoc="x">Places</a>.</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>In GRacket, a handler thread for an eventspace is blocked on
an internal semaphore when its event queue is empty. Thus, the handler
thread is collectible when the eventspace is unreachable and contains
no visible windows or running timers.</p></blockquote></blockquote></blockquote><p>A thread can be used as a <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a> (see
<a href="sync.html" data-pltdoc="x">Events</a>).  A thread is <a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> when
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-wait%29%29" class="RktValLink" data-pltdoc="x">thread-wait</a></span> would not block; the <a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> of a thread is the thread itself.</p><p>All constant-time procedures and operations provided by Racket are
thread-safe because they are <span style="font-style: italic">atomic</span>. For example,
<span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span> assigns to a variable as an atomic action with respect
to all threads, so that no thread can see a &ldquo;half-assigned&rdquo;
variable. Similarly, <span class="RktSym"><a href="vectors.html#%28def._%28%28quote._~23~25kernel%29._vector-set%21%29%29" class="RktValLink" data-pltdoc="x">vector-set!</a></span> assigns to a vector
atomically. The <span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash-set%21%29%29" class="RktValLink" data-pltdoc="x">hash-set!</a></span> procedure is not atomic, but
the table is protected by a lock; see <a href="hashtables.html" data-pltdoc="x">Hash Tables</a> for more
information. Port operations are generally not atomic, but they are
thread-safe in the sense that a byte consumed by one thread from an
input port will not be returned also to another thread, and procedures
like <span class="RktSym"><a href="Byte_and_String_Input.html#%28def._%28%28quote._~23~25kernel%29._port-commit-peeked%29%29" class="RktValLink" data-pltdoc="x">port-commit-peeked</a></span> and <span class="RktSym"><a href="Byte_and_String_Output.html#%28def._%28%28quote._~23~25kernel%29._write-bytes-avail%29%29" class="RktValLink" data-pltdoc="x">write-bytes-avail</a></span> offer
specific concurrency guarantees.</p><h5 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;Creating_Threads&quot;">11.1.1<tt>&nbsp;</tt><a name="(part._.Creating_.Threads)"></a>Creating Threads</h5><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thunk</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thunk</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktVar">thunk</span> with no arguments in a new thread of control. The
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread%29%29" class="RktValLink" data-pltdoc="x">thread</a></span> procedure returns immediately with a <a name="(tech._thread._descriptor)"></a><span style="font-style: italic">thread
descriptor</span> value. When the invocation of <span class="RktVar">thunk</span> returns, the
thread created to invoke <span class="RktVar">thunk</span> terminates.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if
<span class="RktVar">v</span> is a <a href="#%28tech._thread._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">thread descriptor</span></a>, <span class="RktVal">#f</span> otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._current-thread))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-thread%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-thread</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Returns the <a href="#%28tech._thread._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">thread
descriptor</span></a> for the currently executing thread.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread/suspend-to-kill))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread%2Fsuspend-to-kill%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread/suspend-to-kill</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thunk</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thunk</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread%29%29" class="RktValLink" data-pltdoc="x">thread</a></span>, except that &ldquo;killing&rdquo; the thread through
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._kill-thread%29%29" class="RktValLink" data-pltdoc="x">kill-thread</a></span> or <span class="RktSym"><a href="custodians.html#%28def._%28%28quote._~23~25kernel%29._custodian-shutdown-all%29%29" class="RktValLink" data-pltdoc="x">custodian-shutdown-all</a></span> merely
suspends the thread instead of terminating it.  </div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._call-in-nested-thread))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._call-in-nested-thread%29%29" class="RktValDef RktValLink" data-pltdoc="x">call-in-nested-thread</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thunk</span><span class="hspace">&nbsp;</span>[<span class="RktVar">cust</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thunk</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">cust</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="custodians.html#%28def._%28%28quote._~23~25kernel%29._custodian~3f%29%29" class="RktValLink" data-pltdoc="x">custodian?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="custodians.html#%28def._%28%28quote._~23~25kernel%29._current-custodian%29%29" class="RktValLink" data-pltdoc="x">current-custodian</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a nested thread managed by <span class="RktVar">cust</span> to execute
<span class="RktVar">thunk</span>. (The nested thread&rsquo;s current custodian is inherited
from the creating thread, independent of the <span class="RktVar">cust</span> argument.)
The current thread blocks until <span class="RktVar">thunk</span> returns, and the result
of the <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._call-in-nested-thread%29%29" class="RktValLink" data-pltdoc="x">call-in-nested-thread</a></span> call is the result returned by
<span class="RktVar">thunk</span>.</div></p><p>The nested thread&rsquo;s exception handler is initialized to a procedure
that jumps to the beginning of the thread and transfers the exception
to the original thread. The handler thus terminates the nested thread
and re-raises the exception in the original thread.</p><p>If the thread created by <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._call-in-nested-thread%29%29" class="RktValLink" data-pltdoc="x">call-in-nested-thread</a></span> dies before
<span class="RktVar">thunk</span> returns, the <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail%29%29" class="RktValLink" data-pltdoc="x">exn:fail</a></span> exception is raised in the original
thread. If the original thread is killed before <span class="RktVar">thunk</span>
returns, a break is queued for the nested thread.</p><p>If a break is queued for the original thread (with
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._break-thread%29%29" class="RktValLink" data-pltdoc="x">break-thread</a></span>) while the nested thread is running, the break
is redirected to the nested thread. If a break is already queued on
the original thread when the nested thread is created, the break is
moved to the nested thread. If a break remains queued on the nested
thread when it completes, the break is moved to the original thread.</p><h5 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;threadkill&quot;">11.1.2<tt>&nbsp;</tt><a name="(part._threadkill)"></a>Suspending, Resuming, and Killing Threads</h5><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-suspend))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-suspend</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Immediately suspends the execution of <span class="RktVar">thd</span> if it is
running. If the thread has terminated or is already suspended,
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend%29%29" class="RktValLink" data-pltdoc="x">thread-suspend</a></span> has no effect. The thread remains suspended
(i.e., it does not execute) until it is resumed with
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="RktValLink" data-pltdoc="x">thread-resume</a></span>. If the <a href="eval-model.html#%28tech._current._custodian%29" class="techoutside" data-pltdoc="x"><span class="techinside">current custodian</span></a> does not
solely manage <span class="RktVar">thd</span> (i.e., some custodian of <span class="RktVar">thd</span>
is not the current custodian or a subordinate), the
<span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3acontract%29%29" class="RktValLink" data-pltdoc="x">exn:fail:contract</a></span> exception is raised, and the thread is not suspended.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-resume))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-resume</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>[<span class="RktVar">benefactor</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">benefactor</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="custodians.html#%28def._%28%28quote._~23~25kernel%29._custodian~3f%29%29" class="RktValLink" data-pltdoc="x">custodian?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Resumes the execution of <span class="RktVar">thd</span> if it is suspended and has at
least one custodian (possibly added through <span class="RktVar">benefactor</span>, as
described below). If the thread has terminated, or if the thread is
already running and <span class="RktVar">benefactor</span> is not supplied, or if the
thread has no custodian and <span class="RktVar">benefactor</span> is not supplied, then
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="RktValLink" data-pltdoc="x">thread-resume</a></span> has no effect. Otherwise, if
<span class="RktVar">benefactor</span> is supplied, it triggers up to three
additional actions:</div></p><ul><li><p>If <span class="RktVar">benefactor</span> is a thread, whenever it is resumed
from a suspended state in the future, then <span class="RktVar">thd</span> is also
resumed. (Resuming <span class="RktVar">thd</span> may trigger the resumption of other
threads that were previously attached to <span class="RktVar">thd</span> through
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="RktValLink" data-pltdoc="x">thread-resume</a></span>.)</p></li><li><p>New custodians may be added to <span class="RktVar">thd</span>&rsquo;s set of
managers.  If <span class="RktVar">benefactor</span> is a thread, then all of the
thread&rsquo;s custodians are added to <span class="RktVar">thd</span>. Otherwise,
<span class="RktVar">benefactor</span> is a custodian, and it is added to <span class="RktVar">thd</span>
(unless the custodian is already shut down). If <span class="RktVar">thd</span>
becomes managed by both a custodian and one or more of its
subordinates, the redundant subordinates are removed from
<span class="RktVar">thd</span>.  If <span class="RktVar">thd</span> is suspended and a custodian is
added, then <span class="RktVar">thd</span> is resumed only after the addition.</p></li><li><p>If <span class="RktVar">benefactor</span> is a thread, whenever it receives a
new managing custodian in the future, then <span class="RktVar">thd</span> also
receives the custodian. (Adding custodians to <span class="RktVar">thd</span> may
trigger adding the custodians to other threads that were previously
attached to <span class="RktVar">thd</span> through <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume%29%29" class="RktValLink" data-pltdoc="x">thread-resume</a></span>.)</p></li></ul><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._kill-thread))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._kill-thread%29%29" class="RktValDef RktValLink" data-pltdoc="x">kill-thread</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Terminates the specified thread immediately, or suspends the thread if
<span class="RktVar">thd</span> was created with
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread%2Fsuspend-to-kill%29%29" class="RktValLink" data-pltdoc="x">thread/suspend-to-kill</a></span>. Terminating the main thread exits the
application.  If <span class="RktVar">thd</span> has already terminated,
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._kill-thread%29%29" class="RktValLink" data-pltdoc="x">kill-thread</a></span> does nothing.  If the <a href="eval-model.html#%28tech._current._custodian%29" class="techoutside" data-pltdoc="x"><span class="techinside">current custodian</span></a>
does not manage <span class="RktVar">thd</span> (and none of its subordinates manages
<span class="RktVar">thd</span>), the <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3acontract%29%29" class="RktValLink" data-pltdoc="x">exn:fail:contract</a></span> exception is raised, and the thread is not
killed or suspended.</div></p><p>Unless otherwise noted, procedures provided by Racket (and GRacket) are
kill-safe and suspend-safe; that is, killing or suspending a thread
never interferes with the application of procedures in other
threads. For example, if a thread is killed while extracting a
character from an input port, the character is either completely
consumed or not consumed, and other threads can safely use the port.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._break-thread))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._break-thread%29%29" class="RktValDef RktValLink" data-pltdoc="x">break-thread</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>[<span class="RktVar">kind</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">kind</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">hang-up</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">terminate</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara"><a name="(idx._(gentag._183._(lib._scribblings/reference/reference..scrbl)))"></a>Registers a break with the specified
thread, where <span class="RktVar">kind</span> optionally indicates the kind of break to
register. If breaking is disabled in <span class="RktVar">thd</span>, the break will be
ignored until breaks are re-enabled (see <a href="breakhandler.html" data-pltdoc="x">Breaks</a>).</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._sleep))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._sleep%29%29" class="RktValDef RktValLink" data-pltdoc="x">sleep</a></span></span><span class="hspace">&nbsp;</span>[<span class="RktVar">secs</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">secs</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="RktValLink" data-pltdoc="x">&gt;=/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">0</span></td></tr></table></blockquote></div><div class="SIntrapara">Causes the current thread to sleep until at least <span class="RktVar">secs</span>
seconds have passed after it starts sleeping. A zero value for
<span class="RktVar">secs</span> simply acts as a hint to allow other threads to
execute. The value of <span class="RktVar">secs</span> can be a non-integer to request a
sleep duration to any precision; the precision of the actual sleep
time is unspecified.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-running~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-running~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-running?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara"><a name="(idx._(gentag._184._(lib._scribblings/reference/reference..scrbl)))"></a>Returns <span class="RktVal">#t</span> if <span class="RktVar">thd</span>
has not terminated and is not suspended, <span class="RktVal">#f</span> otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-dead~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-dead~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-dead?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">thd</span> has terminated, <span class="RktVal">#f</span>
otherwise.</div></p><h5 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;threadsync&quot;">11.1.3<tt>&nbsp;</tt><a name="(part._threadsync)"></a>Synchronizing Thread State</h5><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-wait))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-wait%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-wait</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Blocks execution of the current thread until <span class="RktVar">thd</span> has
terminated. Note that <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-wait%29%29" class="RktValLink" data-pltdoc="x">thread-wait</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-thread%29%29" class="RktValLink" data-pltdoc="x">current-thread</a></span><span class="RktPn">)</span><span class="RktPn">)</span>
deadlocks the current thread, but a break can end the deadlock (if
breaking is enabled; see <a href="breakhandler.html" data-pltdoc="x">Breaks</a>).</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-dead-evt))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-dead-evt%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-dead-evt</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._evt~3f%29%29" class="RktValLink" data-pltdoc="x">evt?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a> (see <a href="sync.html" data-pltdoc="x">Events</a>) that is
<a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> if and only if <span class="RktVar">thd</span> has terminated.  Unlike using
<span class="RktVar">thd</span> directly, however, a reference to the event does not
prevent <span class="RktVar">thd</span> from being garbage collected (see
<a href="eval-model.html#%28part._gc-model%29" data-pltdoc="x">Garbage Collection</a>). For a given <span class="RktVar">thd</span>,
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-dead-evt%29%29" class="RktValLink" data-pltdoc="x">thread-dead-evt</a></span> always returns the same (i.e., <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span>)
result. The <a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> of a thread-dead event is the thread-dead event itself.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-resume-evt))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume-evt%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-resume-evt</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._evt~3f%29%29" class="RktValLink" data-pltdoc="x">evt?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a> (see <a href="sync.html" data-pltdoc="x">Events</a>) that
becomes <a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> when <span class="RktVar">thd</span> is running.  (If <span class="RktVar">thd</span> has
terminated, the event never becomes ready.)  If <span class="RktVar">thd</span> runs and
is then suspended after a call to <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume-evt%29%29" class="RktValLink" data-pltdoc="x">thread-resume-evt</a></span>, the
result event remains ready; after each suspend of <span class="RktVar">thd</span> a fresh
event is generated to be returned by <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-resume-evt%29%29" class="RktValLink" data-pltdoc="x">thread-resume-evt</a></span>.  The
result of the event is <span class="RktVar">thd</span>, but if <span class="RktVar">thd</span> is never
resumed, then reference to the event does not prevent <span class="RktVar">thd</span>
from being garbage collected (see <a href="eval-model.html#%28part._gc-model%29" data-pltdoc="x">Garbage Collection</a>).</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-suspend-evt))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend-evt%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-suspend-evt</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._evt~3f%29%29" class="RktValLink" data-pltdoc="x">evt?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a> (see <a href="sync.html" data-pltdoc="x">Events</a>) that
becomes <a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> when <span class="RktVar">thd</span> is suspended.  (If <span class="RktVar">thd</span> has
terminated, the event will never unblock.)  If <span class="RktVar">thd</span> is
suspended and then resumes after a call to
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend-evt%29%29" class="RktValLink" data-pltdoc="x">thread-suspend-evt</a></span>, the result event remains ready; after
each resume of <span class="RktVar">thd</span> created a fresh event to be returned by
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-suspend-evt%29%29" class="RktValLink" data-pltdoc="x">thread-suspend-evt</a></span>. The <a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> of a thread-suspend event is the thread-suspend event itself.</div></p><h5 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;threadmbox&quot;">11.1.4<tt>&nbsp;</tt><a name="(part._threadmbox)"></a>Thread Mailboxes</h5><p>Each thread has a <span style="font-style: italic">mailbox</span> through which it can receive
arbitrary messages.  In other words, each thread has a built-in
asynchronous channel.</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="magnify.png" alt="+" width="24" height="24"/></span>See also <a href="async-channel.html" data-pltdoc="x">Buffered Asynchronous Channels</a>.</p></blockquote></blockquote></blockquote><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-send))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-send%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-send</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>[<span class="RktVar">fail-thunk</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thd</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace">&nbsp;&nbsp;</span></td><td valign="top"><span class="RktVar">fail-thunk</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">:</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">=</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="exns.html#%28def._%28%28quote._~23~25kernel%29._raise-mismatch-error%29%29" class="RktValLink" data-pltdoc="x">raise-mismatch-error</a></span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Queues <span class="RktVar">v</span> as a message to <span class="RktVar">thd</span> without blocking. If
the message is queued, the result is <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&amp;rel=void_undefined.html&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#&lt;void&gt;</span></span></a>. If <span class="RktVar">thd</span>
stops running&#8212;<wbr></wbr>as in <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-running~3f%29%29" class="RktValLink" data-pltdoc="x">thread-running?</a></span>&#8212;<wbr></wbr>before the message is
queued, then <span class="RktVar">fail-thunk</span> is called (through a tail call) if it is
a procedure to produce the result, or <span class="RktVal">#f</span> is returned if
<span class="RktVar">fail-thunk</span> is <span class="RktVal">#f</span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-receive))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-receive%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-receive</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Receives and dequeues a message queued for the current thread, if
any. If no message is available, <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-receive%29%29" class="RktValLink" data-pltdoc="x">thread-receive</a></span> blocks until
one is available.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-try-receive))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-try-receive%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-try-receive</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Receives and dequeues a message queued for the current thread, if any,
or returns <span class="RktVal">#f</span> immediately if no message is available.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-receive-evt))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-receive-evt%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-receive-evt</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._evt~3f%29%29" class="RktValLink" data-pltdoc="x">evt?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Returns a constant <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a> (see <a href="sync.html" data-pltdoc="x">Events</a>)
that becomes <a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> when the synchronizing thread has a message to
receive. The <a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> of a thread-receive event is the thread-receive event itself.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._thread-rewind-receive))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._thread-rewind-receive%29%29" class="RktValDef RktValLink" data-pltdoc="x">thread-rewind-receive</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">lst</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">lst</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list~3f%29%29" class="RktValLink" data-pltdoc="x">list?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Pushes the elements of <span class="RktVar">lst</span> back onto the front of the current
thread&rsquo;s queue. The elements are pushed one by one, so that the first
available message is the last element of <span class="RktVar">lst</span>.</div></p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="concurrency.html" title="backward to &quot;11 Concurrency and Parallelism&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="concurrency.html" title="up to &quot;11 Concurrency and Parallelism&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="all-sync.html" title="forward to &quot;11.2 Synchronization&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>