/usr/share/doc/racket/reference/places.html is in racket-doc 6.1-4.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <!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.5 Places</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,"tocview_0");">►</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 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewselflink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </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,"tocview_1");">▼</a></td><td>11 </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 </td><td><a href="threads.html" class="tocviewlink" data-pltdoc="x">Threads</a></td></tr><tr><td align="right">11.2 </td><td><a href="all-sync.html" class="tocviewlink" data-pltdoc="x">Synchronization</a></td></tr><tr><td align="right">11.3 </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 </td><td><a href="futures.html" class="tocviewlink" data-pltdoc="x">Futures</a></td></tr><tr><td align="right">11.5 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Places</a></td></tr><tr><td align="right">11.6 </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,"tocview_2");">►</a></td><td>11.5 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Places</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">11.5.1 </td><td><a href="#%28part._places-api%29" class="tocviewlink" data-pltdoc="x">Using Places</a></td></tr><tr><td align="right">11.5.2 </td><td><a href="#%28part._place-logging%29" class="tocviewlink" data-pltdoc="x">Places Logging</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.5.1<tt> </tt></span><a href="#%28part._places-api%29" class="tocsubseclink" data-pltdoc="x">Using Places</a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-enabled~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>enabled?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>channel?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dynamic-<wbr></wbr>place</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dynamic-<wbr></wbr>place*</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">place</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%2A%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">place*</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-wait%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>wait</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-dead-evt%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>dead-<wbr></wbr>evt</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-kill%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>kill</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-break%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>break</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>channel</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>channel-<wbr></wbr>put</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-get%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>channel-<wbr></wbr>get</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%2Fget%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>channel-<wbr></wbr>put/<span class="mywbr"> </span>get</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-message-allowed~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>message-<wbr></wbr>allowed?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._prop~3aplace-location%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">prop:<span class="mywbr"> </span>place-<wbr></wbr>location</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-location~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">place-<wbr></wbr>location?</span></span></a></td></tr><tr><td><span class="tocsublinknumber">11.5.2<tt> </tt></span><a href="#%28part._place-logging%29" class="tocsubseclink" data-pltdoc="x">Places Logging</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, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="futures.html" title="backward to "11.4 Futures"" data-pltdoc="x">← prev</a> <a href="concurrency.html" title="up to "11 Concurrency and Parallelism"" data-pltdoc="x">up</a> <a href="engine.html" title="forward to "11.6 Engines"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""places"">11.5<tt> </tt><a name="(part._places)"></a><a name="(mod-path._racket/place)"></a>Places</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="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=parallelism.html%23%2528part._effective-places%2529&version=6.1" class="Sq" data-pltdoc="x">Parallelism with Places</a> in <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=index.html&version=6.1" class="Sq" data-pltdoc="x"><span style="font-weight: bold">The Racket Guide</span></a> introduces places.</p></blockquote></blockquote></blockquote><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/place</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">base</span></span></td></tr></table></div><div class="SIntrapara">The bindings documented in this section are provided by the <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/place</span></a> and <a href="index.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket</span></a> libraries, but not <a href="index.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/base</span></a>.</div></p><p><a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">Places</span></a> enable the development of parallel programs that
take advantage of machines with multiple processors, cores, or
hardware threads.</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>Currently, parallel support for places is enabled
only for Racket 3m (which is the main variant of Racket), and only
by default for Windows, Linux x86/x86_64, and Mac OS X x86/x86_64. To
enable support for other platforms, use <span class="nobreak"><span class="stt">--enable-places</span></span> with
<span class="stt">configure</span> when building Racket. The <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-enabled~3f%29%29" class="RktValLink" data-pltdoc="x">place-enabled?</a></span>
function reports whether places run in parallel.</p></blockquote></blockquote></blockquote><p>A <a name="(tech._place)"></a><span style="font-style: italic">place</span> is a parallel task that is effectively a separate
instance of the Racket virtual machine. Places communicate through
<a name="(tech._place._channel)"></a><span style="font-style: italic">place channels</span>, which are endpoints for a two-way buffered
communication.</p><p>To a first approximation, place channels support only immutable,
transparent values as messages. In addition, place
channels themselves can be sent across channels to establish new
(possibly more direct) lines of communication in addition to any
existing lines. Finally, mutable values produced by
<span class="RktSym"><a href="flonums.html#%28def._%28%28lib._racket%2Fflonum..rkt%29._shared-flvector%29%29" class="RktValLink" data-pltdoc="x">shared-flvector</a></span>, <span class="RktSym"><a href="flonums.html#%28def._%28%28lib._racket%2Fflonum..rkt%29._make-shared-flvector%29%29" class="RktValLink" data-pltdoc="x">make-shared-flvector</a></span>,
<span class="RktSym"><a href="fixnums.html#%28def._%28%28lib._racket%2Ffixnum..rkt%29._shared-fxvector%29%29" class="RktValLink" data-pltdoc="x">shared-fxvector</a></span>, <span class="RktSym"><a href="fixnums.html#%28def._%28%28lib._racket%2Ffixnum..rkt%29._make-shared-fxvector%29%29" class="RktValLink" data-pltdoc="x">make-shared-fxvector</a></span>,
<span class="RktSym"><a href="bytestrings.html#%28def._%28%28quote._~23~25kernel%29._shared-bytes%29%29" class="RktValLink" data-pltdoc="x">shared-bytes</a></span>, and <span class="RktSym"><a href="bytestrings.html#%28def._%28%28quote._~23~25kernel%29._make-shared-bytes%29%29" class="RktValLink" data-pltdoc="x">make-shared-bytes</a></span> can be sent
across place channels; mutation of such values is visible to all
places that share the value, because they are allowed in a
<a name="(tech._shared._memory._space)"></a><span style="font-style: italic">shared memory space</span>. See <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-message-allowed~3f%29%29" class="RktValLink" data-pltdoc="x">place-message-allowed?</a></span>.</p><p>A <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a> 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>) to receive a value through the channel.
A <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a> is <a href="sync.html#%28tech._ready._for._synchronization%29" class="techoutside" data-pltdoc="x"><span class="techinside">ready for synchronization</span></a> when
a message is available on the channel, and the <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a>’s
<a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> is the message (which is removed on
synchronization). A place
can also receive messages with <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-get%29%29" class="RktValLink" data-pltdoc="x">place-channel-get</a></span>, and
messages can be sent with <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%29%29" class="RktValLink" data-pltdoc="x">place-channel-put</a></span>.</p><p>Two <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channels</span></a> are <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span> if they are endpoints
for the same underlying channels while both or neither is a
<a href="#%28tech._place._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">place descriptor</span></a>. <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">Place channels</span></a> can be <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span>
without being <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> after being sent messages through a
<a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a>.</p><p>Constraints on messages across a place channel—<wbr></wbr>and therefore on the
kinds of data that places share—<wbr></wbr>enable greater parallelism than
<span class="RktSym"><a href="futures.html#%28def._%28%28lib._racket%2Ffuture..rkt%29._future%29%29" class="RktValLink" data-pltdoc="x">future</a></span>, even including separate <a href="eval-model.html#%28tech._garbage._collection%29" class="techoutside" data-pltdoc="x"><span class="techinside">garbage collection</span></a> of
separate places. At the same time, the setup and communication costs
for places can be higher than for <a href="futures.html#%28tech._future%29" class="techoutside" data-pltdoc="x"><span class="techinside">futures</span></a>.</p><p>For example, the following expression launches two places, echoes a
message to each, and then waits for the places to terminate:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">pls</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="for.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%2Flist%29%29" class="RktStxLink" data-pltdoc="x">for/list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">i</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="sequences.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._in-range%29%29" class="RktValLink" data-pltdoc="x">in-range</a></span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span><span class="hspace"> </span><span class="RktVal">"place-worker.rkt"</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">place-main</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="for.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%29%29" class="RktStxLink" data-pltdoc="x">for</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">i</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="sequences.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._in-range%29%29" class="RktValLink" data-pltdoc="x">in-range</a></span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">p</span><span class="hspace"> </span><span class="RktSym">pls</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%29%29" class="RktValLink" data-pltdoc="x">place-channel-put</a></span><span class="hspace"> </span><span class="RktSym">p</span><span class="hspace"> </span><span class="RktSym">i</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._printf%29%29" class="RktValLink" data-pltdoc="x">printf</a></span><span class="hspace"> </span><span class="RktVal">"~a\n"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-get%29%29" class="RktValLink" data-pltdoc="x">place-channel-get</a></span><span class="hspace"> </span><span class="RktSym">p</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-wait%29%29" class="RktValLink" data-pltdoc="x">place-wait</a></span><span class="hspace"> </span><span class="RktSym">pls</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>The <span class="stt">"place-worker.rkt"</span> module must export the
<span class="RktSym">place-main</span> function that each place executes, where
<span class="RktSym">place-main</span> must accept a single <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a>
argument:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="index.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span><span class="hspace"> </span><span class="RktSym">place-main</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">place-main</span><span class="hspace"> </span><span class="RktSym">pch</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%29%29" class="RktValLink" data-pltdoc="x">place-channel-put</a></span><span class="hspace"> </span><span class="RktSym">pch</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="hspace"> </span><span class="RktVal">"Hello from place ~a"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-get%29%29" class="RktValLink" data-pltdoc="x">place-channel-get</a></span><span class="hspace"> </span><span class="RktSym">pch</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>Place channels are subject to <a href="eval-model.html#%28tech._garbage._collection%29" class="techoutside" data-pltdoc="x"><span class="techinside">garbage collection</span></a>, like other
Racket values, and a <a href="eval-model.html#%28tech._thread%29" class="techoutside" data-pltdoc="x"><span class="techinside">thread</span></a> that is blocked reading from a
<a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a> can be garbage collected if <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place
channel</span></a>’s writing end becomes unreachable. <a name="(elem._(caveat._place-channel-gc))"></a>However, unlike normal <a href="channel.html#%28tech._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">channel</span></a> blocking,
if otherwise unreachable threads are mutually blocked on place
channels that are reachable only from the same threads, the threads
and place channels are all considered reachable, instead of
unreachable.</p><p>When a place is created, its <a href="eval-model.html#%28tech._parameter%29" class="techoutside" data-pltdoc="x"><span class="techinside">parameter</span></a> values are generally set
to the <span style="font-style: italic">initial</span> values of the parameters in the creating place,
except that the <span style="font-style: italic">current</span> values of the following parameters are
used: <span class="RktSym"><a href="collects.html#%28def._%28%28quote._~23~25kernel%29._current-library-collection-paths%29%29" class="RktValLink" data-pltdoc="x">current-library-collection-paths</a></span>,
<span class="RktSym"><a href="collects.html#%28def._%28%28quote._~23~25kernel%29._current-library-collection-links%29%29" class="RktValLink" data-pltdoc="x">current-library-collection-links</a></span>, and
<span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._current-compiled-file-roots%29%29" class="RktValLink" data-pltdoc="x">current-compiled-file-roots</a></span>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""places-api"">11.5.1<tt> </tt><a name="(part._places-api)"></a>Using Places</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._((lib._racket/place..rkt)._place-enabled~3f))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-enabled~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-enabled?</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if Racket is configured so that
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span> and <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="RktStxLink" data-pltdoc="x">place</a></span> create places that can run
in parallel, <span class="RktVal">#f</span> if <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span> and <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="RktStxLink" data-pltdoc="x">place</a></span>
are simulated using <span class="RktSym"><a href="threads.html#%28def._%28%28quote._~23~25kernel%29._thread%29%29" class="RktValLink" data-pltdoc="x">thread</a></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._((lib._racket/place..rkt)._place~3f))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">place?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </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 name="(tech._place._descriptor)"></a><span style="font-style: italic">place descriptor</span>
value, <span class="RktVal">#f</span> otherwise. Every <a href="#%28tech._place._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">place descriptor</span></a>
is also a <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></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._((lib._racket/place..rkt)._place-channel~3f))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-channel?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </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 href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._racket/place..rkt)._dynamic-place))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValDef RktValLink" data-pltdoc="x">dynamic-place</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">module-path</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">start-name</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:at</span><span class="hspace"> </span><span class="RktVar">location</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:named</span><span class="hspace"> </span><span class="RktVar">named</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValLink" data-pltdoc="x">place?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">module-path</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktSym"><a href="Module_Names_and_Loading.html#%28def._%28%28quote._~23~25kernel%29._module-path~3f%29%29" class="RktValLink" data-pltdoc="x">module-path?</a></span><span class="hspace"> </span><span class="RktSym"><a href="Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path~3f%29%29" class="RktValLink" data-pltdoc="x">path?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">start-name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">location</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-location~3f%29%29" class="RktValLink" data-pltdoc="x">place-location?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">named</span><span class="hspace"> </span>:<span class="hspace"> </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><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a <a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a> to run the procedure that is identified by
<span class="RktVar">module-path</span> and <span class="RktVar">start-name</span>. The result is a
<a href="#%28tech._place._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">place descriptor</span></a> value that represents the new parallel task;
the place descriptor is returned immediately. The place descriptor
value is also a <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a> that permits communication with
the place.</div></p><p>The module indicated by <span class="RktVar">module-path</span> must export a function
with the name <span class="RktSym">start-proc</span>. The function must accept a single
argument, which is a <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channel</span></a> that corresponds to the
other end of communication for the <a href="#%28tech._place._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">place descriptor</span></a> returned
by <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="RktStxLink" data-pltdoc="x">place</a></span>.</p><p>If <span class="RktVar">location</span> is provided, it must be a <a href="#%28tech._place._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">place location</span></a>,
such as a distributed places node produced by <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=distributed-places&rel=index.html%23%2528def._%2528%2528lib._racket%252Fplace%252Fdistributed..rkt%2529._create-place-node%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">create-place-node</a></span>.</p><p>When the <a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a> is created, the initial <a href="Exiting.html#%28tech._exit._handler%29" class="techoutside" data-pltdoc="x"><span class="techinside">exit handler</span></a>
terminates the place, using the argument to the exit handler as the
place’s <a name="(tech._completion._value)"></a><span style="font-style: italic">completion value</span>. Use <span class="RktPn">(</span><span class="RktSym"><a href="Exiting.html#%28def._%28%28quote._~23~25kernel%29._exit%29%29" class="RktValLink" data-pltdoc="x">exit</a></span><span class="stt"> </span><span class="RktVar">v</span><span class="RktPn">)</span> to
immediately terminate a place with the completion value
<span class="RktVar">v</span>. Since a completion value is limited to an exact integer
between <span class="RktVal">0</span> and <span class="RktVal">255</span>, any other value for <span class="RktSym">v</span>
is converted to <span class="RktVal">0</span>.</p><p>If the function indicated by <span class="RktVar">module-path</span> and
<span class="RktSym">start-proc</span> returns, then the place terminates with the
<a href="#%28tech._completion._value%29" class="techoutside" data-pltdoc="x"><span class="techinside">completion value</span></a> <span class="RktVal">0</span>.</p><p>In the created place, the <span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-input-port%29%29" class="RktValLink" data-pltdoc="x">current-input-port</a></span> parameter is
set to an empty input port, while the values of the
<span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-output-port%29%29" class="RktValLink" data-pltdoc="x">current-output-port</a></span> and <span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-error-port%29%29" class="RktValLink" data-pltdoc="x">current-error-port</a></span>
parameters are connected to the current ports in the creating place.
If the output ports in the creating place are <a href="file-ports.html#%28tech._file._stream._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">file-stream
ports</span></a>, then the connected ports in the created place share the
underlying streams, otherwise a <a href="eval-model.html#%28tech._thread%29" class="techoutside" data-pltdoc="x"><span class="techinside">thread</span></a> in the creating place
pumps bytes from the created place’s ports to the current ports in the
creating place.</p><p>The <span class="RktVar">module-path</span> argument must not be a module path of the
form <span class="RktPn">(</span><span class="RktSym"><a href="quote.html#%28form._%28%28quote._~23~25kernel%29._quote%29%29" class="RktStxLink" data-pltdoc="x">quote</a></span><span class="stt"> </span><span class="RktVar">sym</span><span class="RktPn">)</span> unless the module is predefined (see
<span class="RktSym"><a href="Module_Names_and_Loading.html#%28def._%28%28quote._~23~25kernel%29._module-predefined~3f%29%29" class="RktValLink" data-pltdoc="x">module-predefined?</a></span>).</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._racket/place..rkt)._dynamic-place*))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="RktValDef RktValLink" data-pltdoc="x">dynamic-place*</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">module-path</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">start-name</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:in</span><span class="hspace"> </span><span class="RktVar">in</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:out</span><span class="hspace"> </span><span class="RktVar">out</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:err</span><span class="hspace"> </span><span class="RktVar">err</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0"><tr><td><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValLink" data-pltdoc="x">place?</a></span></td></tr><tr><td><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"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._output-port~3f%29%29" class="RktValLink" data-pltdoc="x">output-port?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><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"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._input-port~3f%29%29" class="RktValLink" data-pltdoc="x">input-port?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><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"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._input-port~3f%29%29" class="RktValLink" data-pltdoc="x">input-port?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">module-path</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktSym"><a href="Module_Names_and_Loading.html#%28def._%28%28quote._~23~25kernel%29._module-path~3f%29%29" class="RktValLink" data-pltdoc="x">module-path?</a></span><span class="hspace"> </span><span class="RktSym"><a href="Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path~3f%29%29" class="RktValLink" data-pltdoc="x">path?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">start-name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">in</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._input-port~3f%29%29" class="RktValLink" data-pltdoc="x">input-port?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">out</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._output-port~3f%29%29" class="RktValLink" data-pltdoc="x">output-port?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-output-port%29%29" class="RktValLink" data-pltdoc="x">current-output-port</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">err</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._output-port~3f%29%29" class="RktValLink" data-pltdoc="x">output-port?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-error-port%29%29" class="RktValLink" data-pltdoc="x">current-error-port</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span>, but accepts specific ports to the new
place’s ports, and returns a created port when <span class="RktVal">#f</span> is
supplied for a port. The <span class="RktVar">in</span>, <span class="RktVar">out</span>, and
<span class="RktVar">err</span> ports are connected to the <span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-input-port%29%29" class="RktValLink" data-pltdoc="x">current-input-port</a></span>,
<span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-output-port%29%29" class="RktValLink" data-pltdoc="x">current-output-port</a></span>, and <span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._current-error-port%29%29" class="RktValLink" data-pltdoc="x">current-error-port</a></span> ports,
respectively, for the
<a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a>. Any of the ports can be <span class="RktVal">#f</span>, in which case a
<a href="file-ports.html#%28tech._file._stream._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">file-stream port</span></a> (for an operating-system pipe)
is created and returned by <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="RktValLink" data-pltdoc="x">dynamic-place*</a></span>. The
<span class="RktVar">err</span> argument can be <span class="RktVal">'</span><span class="RktVal">stdout</span>, in which case the
same <a href="file-ports.html#%28tech._file._stream._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">file-stream port</span></a> or that is supplied as standard
output is also used for standard error. For each port or
<span class="RktVal">'</span><span class="RktVal">stdout</span> that is provided, no pipe is created and the
corresponding returned value is <span class="RktVal">#f</span>.</div></p><p>The caller of <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="RktValLink" data-pltdoc="x">dynamic-place*</a></span> is responsible for closing all
returned ports; none are closed automatically.</p><p>The <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="RktValLink" data-pltdoc="x">dynamic-place*</a></span> procedure returns four values:</p><ul><li><p>a place descriptor value representing the created place;</p></li><li><p>an output port piped to the place’s standard input, or
<span class="RktVal">#f</span> if <span class="RktVar">in</span> was a port;</p></li><li><p>an input port piped from the place’s standard output, or
<span class="RktVal">#f</span> if <span class="RktVar">out</span> was a port;</p></li><li><p>an input port piped from the place’s standard error, or
<span class="RktVal">#f</span> if <span class="RktVar">err</span> was a port or <span class="RktVal">'</span><span class="RktVal">stdout</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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/place..rkt)._place))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">place</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">body</span><span class="hspace"> </span><span class="RktMeta">...+</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Creates a place that evaluates <span class="RktVar">body</span>
expressions with <span class="RktVar">id</span> bound to a place channel. The
<span class="RktVar">body</span>s close only over <span class="RktVar">id</span> plus the top-level
bindings of the enclosing module, because the
<span class="RktVar">body</span>s are lifted to a function that is exported by
the module. The result of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="RktStxLink" data-pltdoc="x">place</a></span> is a place descriptor,
like the result of <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></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>syntax</p></div></div><table cellspacing="0" cellpadding="0" class="RktBlk RForeground"><tr><td><span class="RktPn">(</span><a name="(form._((lib._racket/place..rkt)._place*))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%2A%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">place*</a></span></span><span class="hspace"> </span><span class="RktVar">maybe-port</span><span class="hspace"> </span><span class="RktMeta">...</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">body</span><span class="hspace"> </span><span class="RktMeta">...+</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">maybe-port</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:in</span><span class="hspace"> </span><span class="RktVar">in-expr</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:out</span><span class="hspace"> </span><span class="RktVar">out-expr</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:err</span><span class="hspace"> </span><span class="RktVar">err-expr</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%29%29" class="RktStxLink" data-pltdoc="x">place</a></span>, but supports optional <span class="RktPn">#:in</span>, <span class="RktPn">#:out</span>,
and <span class="RktPn">#:err</span> expressions (at most one of each) to specify ports in the same way and
with the same defaults as <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="RktValLink" data-pltdoc="x">dynamic-place*</a></span>. The result of
a <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fplace..rkt%29._place%2A%29%29" class="RktStxLink" data-pltdoc="x">place*</a></span> form is also the same as for <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%2A%29%29" class="RktValLink" data-pltdoc="x">dynamic-place*</a></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._((lib._racket/place..rkt)._place-wait))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-wait%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-wait</a></span></span><span class="hspace"> </span><span class="RktVar">p</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-integer?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValLink" data-pltdoc="x">place?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the <a href="#%28tech._completion._value%29" class="techoutside" data-pltdoc="x"><span class="techinside">completion value</span></a> of the place indicated by <span class="RktVar">p</span>,
blocking until the place has terminated.</div></p><p>If any pumping threads were created to connect a
non-<a href="file-ports.html#%28tech._file._stream._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">file-stream port</span></a> to the ports in the place for <span class="RktVar">p</span>
(see <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span>), <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-wait%29%29" class="RktValLink" data-pltdoc="x">place-wait</a></span> returns only when
the pumping threads have completed. </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._((lib._racket/place..rkt)._place-dead-evt))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-dead-evt%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-dead-evt</a></span></span><span class="hspace"> </span><span class="RktVar">p</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </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"> </span><span class="RktVar">p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValLink" data-pltdoc="x">place?</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">p</span> has terminated.
The <a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a> of a place-dead event is the place-dead event itself.</div></p><p>If any pumping threads were created to connect a non-<a href="file-ports.html#%28tech._file._stream._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">file-stream
port</span></a> to the ports in the place for <span class="RktVar">p</span> (see
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span>), the event returned by
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-dead-evt%29%29" class="RktValLink" data-pltdoc="x">place-dead-evt</a></span> may become ready even if a pumping thread is
still running.</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._((lib._racket/place..rkt)._place-kill))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-kill%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-kill</a></span></span><span class="hspace"> </span><span class="RktVar">p</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </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"> </span><span class="RktVar">p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValLink" data-pltdoc="x">place?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Immediately terminates the place, setting the place’s
<a href="#%28tech._completion._value%29" class="techoutside" data-pltdoc="x"><span class="techinside">completion value</span></a> to <span class="RktVal">1</span> if the place does not have a
completion value already.</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._((lib._racket/place..rkt)._place-break))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-break%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-break</a></span></span><span class="hspace"> </span><span class="RktVar">p</span><span class="hspace"> </span>[<span class="RktVar">kind</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </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"> </span><span class="RktVar">p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place~3f%29%29" class="RktValLink" data-pltdoc="x">place?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">kind</span><span class="hspace"> </span>:<span class="hspace"> </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"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">hang-up</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">terminate</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Sends the main thread of place <span class="RktVar">p</span> a break; 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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._racket/place..rkt)._place-channel))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-channel</a></span></span><span class="RktPn"></span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0"><tr><td><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="RktValLink" data-pltdoc="x">place-channel?</a></span></td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="RktValLink" data-pltdoc="x">place-channel?</a></span></td></tr></table></td></tr></table></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Returns two <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channels</span></a>. Data sent through the first
channel can be received through the second channel, and data sent
through the second channel can be received from the first.</div></p><p>Typically, one place channel is used by the current <a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a> to
send messages to a destination <a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a>; the other place channel
is sent to the destination <a href="#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a> (via an existing <a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place
channel</span></a>).</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._((lib._racket/place..rkt)._place-channel-put))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-channel-put</a></span></span><span class="hspace"> </span><span class="RktVar">pch</span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void%29%29" class="RktValLink" data-pltdoc="x">void</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">pch</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="RktValLink" data-pltdoc="x">place-channel?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-message-allowed~3f%29%29" class="RktValLink" data-pltdoc="x">place-message-allowed?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Sends a message <span class="RktVar">v</span> on channel <span class="RktVar">pch</span>. Since place channels
are asynchronous, <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%29%29" class="RktValLink" data-pltdoc="x">place-channel-put</a></span> calls are non-blocking.</div></p><p>See <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-message-allowed~3f%29%29" class="RktValLink" data-pltdoc="x">place-message-allowed?</a></span> form information on automatic
coercions in <span class="RktVar">v</span>, such as converting a mutable string to an
immutable string.</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._((lib._racket/place..rkt)._place-channel-get))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-get%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-channel-get</a></span></span><span class="hspace"> </span><span class="RktVar">pch</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-message-allowed~3f%29%29" class="RktValLink" data-pltdoc="x">place-message-allowed?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">pch</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="RktValLink" data-pltdoc="x">place-channel?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a message received on channel <span class="RktVar">pch</span>, blocking until a
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._((lib._racket/place..rkt)._place-channel-put/get))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel-put%2Fget%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-channel-put/get</a></span></span><span class="hspace"> </span><span class="RktVar">pch</span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </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><tr><td><span class="hspace"> </span><span class="RktVar">pch</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-channel~3f%29%29" class="RktValLink" data-pltdoc="x">place-channel?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </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">Sends an immutable message <span class="RktVar">v</span> on channel <span class="RktVar">pch</span> and then
waits for a message (perhaps a reply) on the same channel.</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._((lib._racket/place..rkt)._place-message-allowed~3f))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-message-allowed~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-message-allowed?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </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 allowed as a message on a place channel,
<span class="RktVal">#f</span> otherwise.</div></p><p>If <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-enabled~3f%29%29" class="RktValLink" data-pltdoc="x">place-enabled?</a></span><span class="RktPn">)</span> returns <span class="RktVal">#f</span>, then the result is
always <span class="RktVal">#t</span> and no conversions are performed on <span class="RktVar">v</span> as a
message. Otherwise, the following kinds of data are allowed as
messages:</p><ul><li><p><a href="numbers.html#%28tech._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">numbers</span></a>, <a href="characters.html#%28tech._character%29" class="techoutside" data-pltdoc="x"><span class="techinside">characters</span></a>, <a href="booleans.html#%28tech._boolean%29" class="techoutside" data-pltdoc="x"><span class="techinside">booleans</span></a>, <a href="keywords.html#%28tech._keyword%29" class="techoutside" data-pltdoc="x"><span class="techinside">keywords</span></a>, and
<a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<void></span></span></a>;</p></li><li><p><a href="symbols.html#%28tech._symbol%29" class="techoutside" data-pltdoc="x"><span class="techinside">symbols</span></a>, where the <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>ness of <a href="symbols.html#%28tech._uninterned%29" class="techoutside" data-pltdoc="x"><span class="techinside">uninterned</span></a>
symbols is preserved within a single message, but not across
messages;</p></li><li><p><a href="strings.html#%28tech._string%29" class="techoutside" data-pltdoc="x"><span class="techinside">strings</span></a> and <a href="bytestrings.html#%28tech._byte._string%29" class="techoutside" data-pltdoc="x"><span class="techinside">byte strings</span></a>, where mutable strings
and byte strings are automatically replaced by immutable
variants;</p></li><li><p><a href="pathutils.html#%28tech._path%29" class="techoutside" data-pltdoc="x"><span class="techinside">paths</span></a> (for any platform);</p></li><li><p><a href="pairs.html#%28tech._pair%29" class="techoutside" data-pltdoc="x"><span class="techinside">pairs</span></a>, <a href="pairs.html#%28tech._list%29" class="techoutside" data-pltdoc="x"><span class="techinside">lists</span></a>, <a href="vectors.html#%28tech._vector%29" class="techoutside" data-pltdoc="x"><span class="techinside">vectors</span></a>, and immutable
<a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structures containing message-allowed values,
where a mutable vector is automatically replaced by an
immutable vector;</p></li><li><p><a href="hashtables.html#%28tech._hash._table%29" class="techoutside" data-pltdoc="x"><span class="techinside">hash tables</span></a> where mutable hash tables are automatically
replaced by immutable variants;</p></li><li><p><a href="#%28tech._place._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">place channels</span></a>, where a <a href="#%28tech._place._descriptor%29" class="techoutside" data-pltdoc="x"><span class="techinside">place descriptor</span></a> is
automatically replaced by a plain place channel;</p></li><li><p><a href="file-ports.html#%28tech._file._stream._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">file-stream ports</span></a> and <a href="tcp.html#%28tech._tcp._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">TCP ports</span></a>, where the
underlying representation (such as a file descriptor, socket,
or handle) is duplicated and attached to a fresh port in the
receiving place;</p></li><li><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=foreign&rel=Pointer_Types.html%23%2528tech._c._pointer%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">C
pointers</span></a> as created or accessed via <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=foreign&rel=index.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">ffi/unsafe</span></a>; and</p></li><li><p>values produced by <span class="RktSym"><a href="flonums.html#%28def._%28%28lib._racket%2Fflonum..rkt%29._shared-flvector%29%29" class="RktValLink" data-pltdoc="x">shared-flvector</a></span>,
<span class="RktSym"><a href="flonums.html#%28def._%28%28lib._racket%2Fflonum..rkt%29._make-shared-flvector%29%29" class="RktValLink" data-pltdoc="x">make-shared-flvector</a></span>, <span class="RktSym"><a href="fixnums.html#%28def._%28%28lib._racket%2Ffixnum..rkt%29._shared-fxvector%29%29" class="RktValLink" data-pltdoc="x">shared-fxvector</a></span>,
<span class="RktSym"><a href="fixnums.html#%28def._%28%28lib._racket%2Ffixnum..rkt%29._make-shared-fxvector%29%29" class="RktValLink" data-pltdoc="x">make-shared-fxvector</a></span>, <span class="RktSym"><a href="bytestrings.html#%28def._%28%28quote._~23~25kernel%29._shared-bytes%29%29" class="RktValLink" data-pltdoc="x">shared-bytes</a></span>, and
<span class="RktSym"><a href="bytestrings.html#%28def._%28%28quote._~23~25kernel%29._make-shared-bytes%29%29" class="RktValLink" data-pltdoc="x">make-shared-bytes</a></span>.</p></li></ul><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._racket/place..rkt)._prop~3aplace-location))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._prop~3aplace-location%29%29" class="RktValDef RktValLink" data-pltdoc="x">prop:place-location</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="structprops.html#%28def._%28%28quote._~23~25kernel%29._struct-type-property~3f%29%29" class="RktValLink" data-pltdoc="x">struct-type-property?</a></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._racket/place..rkt)._place-location~3f))"></a><span title="Provided from: racket/place, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-location~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">place-location?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </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></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="structprops.html#%28tech._structure._type._property%29" class="techoutside" data-pltdoc="x"><span class="techinside">structure type property</span></a> and associated predicate for
implementations of <a name="(tech._place._location)"></a><span style="font-style: italic">place locations</span>. The value of
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._prop~3aplace-location%29%29" class="RktValLink" data-pltdoc="x">prop:place-location</a></span> must be a procedure of four arguments:
the <a href="#%28tech._place._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">place location</span></a> itself, a module path, a symbol for the
start function exported by the module, and a place name (which can be
<span class="RktVal">#f</span> for an anonymous place).</div></p><p>A <a href="#%28tech._place._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">place location</span></a> can be passed as the <span class="RktPn">#:at</span> argument to
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._dynamic-place%29%29" class="RktValLink" data-pltdoc="x">dynamic-place</a></span>, which in turn simply calls the
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._prop~3aplace-location%29%29" class="RktValLink" data-pltdoc="x">prop:place-location</a></span> value of the <a href="#%28tech._place._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">place location</span></a>.</p><p>A distributed places note created with <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=distributed-places&rel=index.html%23%2528def._%2528%2528lib._racket%252Fplace%252Fdistributed..rkt%2529._create-place-node%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">create-place-node</a></span>
is an example of a <a href="#%28tech._place._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">place location</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""place-logging"">11.5.2<tt> </tt><a name="(part._place-logging)"></a>Places Logging</h5><p>Place events are reported to a logger named <span class="RktVal">'</span><span class="RktVal">place</span>.
In addition to its string message, each event logged for a place has
a data value that is an instance of a <span class="RktSym">place-event</span>
<a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structure:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define-struct.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct%29%29" class="RktStxLink" data-pltdoc="x">struct</a></span><span class="hspace"> </span><span class="RktSym">place-event</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">place-id</span><span class="hspace"> </span><span class="RktSym">action</span><span class="hspace"> </span><span class="RktSym">value</span><span class="hspace"> </span><span class="RktSym"><a href="time.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._time%29%29" class="RktStxLink" data-pltdoc="x">time</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:prefab</span><span class="RktPn">)</span></td></tr></table></blockquote><p>The <span class="RktSym">place-id</span> field is an exact integer that identifies a
place.</p><p>The <span class="RktSym"><a href="time.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._time%29%29" class="RktStxLink" data-pltdoc="x">time</a></span> field is an inexact number that represents time in
the same way as <span class="RktSym"><a href="time.html#%28def._%28%28quote._~23~25kernel%29._current-inexact-milliseconds%29%29" class="RktValLink" data-pltdoc="x">current-inexact-milliseconds</a></span>.</p><p>The <span class="RktSym">action</span> field is a symbol:</p><ul><li><p><span class="RktVal">'</span><span class="RktVal">create</span>: a place was created. This event is logged in the
creating place, and the event’s <span class="RktSym">value</span> field has the
ID for the created place.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">reap</span>: a place that was previously created in the
current place has exited (and that fact has been detected,
possibly via <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fplace..rkt%29._place-wait%29%29" class="RktValLink" data-pltdoc="x">place-wait</a></span>). The event’s <span class="RktSym">value</span>
field has the ID for the exited place.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">enter</span>: a place has started, logged within the started
place. The event’s <span class="RktSym">value</span> field has <span class="RktVal">#f</span>.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">exit</span>: a place is exiting, logged within the exiting
place. The event’s <span class="RktSym">value</span> field has <span class="RktVal">#f</span>.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">put</span>: a place-channel message has been sent. The
event’s <span class="RktSym">value</span> field is a positive exact integer that
approximates the message’s size.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">get</span>: a place-channel message has been received. The
event’s <span class="RktSym">value</span> field is a positive exact integer that
approximates the message’s size.</p></li></ul><p class="SHistory">Changed in version 6.0.0.2 of package <span class="stt">base</span>: Added logging via <span class="RktVal">'</span><span class="RktVal">place</span>
and <span class="RktSym">place-event</span>.</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, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="futures.html" title="backward to "11.4 Futures"" data-pltdoc="x">← prev</a> <a href="concurrency.html" title="up to "11 Concurrency and Parallelism"" data-pltdoc="x">up</a> <a href="engine.html" title="forward to "11.6 Engines"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|