Consider the following code<div><br></div><div><div>stamp v x = do</div><div>&nbsp;&nbsp;t &lt;- getCurrentTime&nbsp;</div><div>&nbsp;&nbsp;putMVar v (x,t)</div><div><br></div><div>Is it possible - with GHC - that a thread switch happens after the t &lt;- getCurrentTime and the putMVar v (x,t)?&nbsp;<br>
</div><div><br></div><div>If so, how would it be possible to make sure that the operation of reading the current time and writing the pair to the MVar is an &quot;atomic&quot; operation, in the sense that no thread switch can happen between the two? Would this require STM?<br>
</div><div><br></div><div>Thanks again for sharing your wisdom with me :)</div><div><br></div><div>Peter<br></div><div><br></div></div>