<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"><<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>></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 <<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>> wrote:<br>
<br>
> 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 & primitiveFileSetPosition; replace them with primitiveFileReadFileIDFilePtrIntoArrayStartingAtCount & 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'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's not *that* bad a problem, unless you'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'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>
"How many Teela Browns does it take to change a lightbulb?" "Stupid question."<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>