<div dir="ltr"><div style="font-size:13px">Thank you.<br></div><span style="font-size:13px">You're right, and you've answered on part of my question:</span><span class="im" style="font-size:13px"><div><br><div><< Now, anything can happen in between, so in particular, ets:take/2 may return [] if the key was deleted or taken out by another process between the two calls.>></div></div><div><br></div></span><div style="font-size:13px">I would like to ask the community what do you think about to add to ets module two atomic functions: ets:take_first/1 and ets:take_last/1 ?</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-15 1:39 GMT+03:00 Alexandre Beniaminov <span dir="ltr"><<a href="mailto:abeniaminov@gmail.com" target="_blank">abeniaminov@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thank you.<br></div>You're right, and you've answered on part of my question:<span class=""><div><br><div><< <span style="font-size:13px">Now, anything can happen in between, so in particular, ets:take/2 may return [] if the key was deleted or taken out by another process between the two calls.>></span></div></div><div><span style="font-size:13px"><br></span></div></span><div>I would like to ask the community what do you think about to add to ets module two atomic functions: ets:take_first/1 and ets:take_last/1 ?<br></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">2016-07-14 21:19 GMT+03:00 Jesper Louis Andersen <span dir="ltr"><<a href="mailto:jesper.louis.andersen@gmail.com" target="_blank">jesper.louis.andersen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 14, 2016 at 8:06 PM, Alexandre Beniaminov <span dir="ltr"><<a href="mailto:abeniaminov@gmail.com" target="_blank">abeniaminov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">atomic</blockquote></div><br>You have to say what you expect to be atomic/linearizable. In your above code, suppose you are being scheduled out between the call to ets:first/1 and ets:take/2. Now, anything can happen in between, so in particular, ets:take/2 may return [] if the key was deleted or taken out by another process between the two calls.</div><div class="gmail_extra"><br></div><div class="gmail_extra">But taken individually, the set of ets:first/1, ets:take/2 and ets:lookup/2 ought to be linearizable. I.e., there is some point in time (the atomic commit-point) at which ets:take/2 removes the objects. After this commit-point first/1 and lookup/2 will not see the Key present in the table anymore.</div><div class="gmail_extra"><br></div><div class="gmail_extra">So the question of if it is atomic or not depends on the precise definition of what you ask.<span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature">J.</div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div data-smartmail="gmail_signature">С уважением,<br>Александр Бениаминов<br></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">С уважением,<br>Александр Бениаминов<br></div>
</div>