<div dir="ltr">Hi Tim,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 21, 2013 at 3:42 PM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 21-01-2013, at 3:21 PM, Bert Freudenberg &lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt; wrote:<br>
<br>
&gt; How do we make that single copy thread-safe?<br>
<br>
</div>If you refer to the problem that I am familiar with, by getting rid of the four primitives primitiveFileRead, primitiveFileWrite, primitiveFileGetPosition &amp; primitiveFileSetPosition; replace them with primitiveFileReadFileIDFilePtrIntoArrayStartingAtCount &amp; primitiveFileWriteFileIDFilePtrFromArrayStartingAtCount<br>
</blockquote><div><br></div><div>Alas it bites at a slightly higher-level than that also.  Yes, the decoupling of positioning and reading is a problem for thread-safety.  But so is the single buffer and the single position.  e.g. if one were to call your unified primitive below to fill the buffer that wouldn&#39;t prevent another thread reading at a different position into the same buffer and trashing the contents from the POV of the first thread. Since the programming tools are essentially single-threaded it&#39;s not *that* bad a problem, unless you&#39;re debugging source access (I *think*).</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That way there is no gap between setting the file position and reading/writing. Some OS&#39;s (coughRISC OS) have this as the base api anyway.<br>

<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br>
&quot;How many Teela Browns does it take to change a lightbulb?&quot; &quot;Stupid question.&quot;<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>