<html><head></head><body><div class="ydpcf5cb084yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div>What are the chances it would run out of reductions? What about drop the update if it runs out of reductions. </div><div><br></div><div>Most use cases I see are putting/removing/merging elements into various collections. Complex business logic should be done outside, then you get inside the lock and simply do a ++, --, :maps.put, :maps.merge, etc.</div><div><br></div>
</div><div id="yahoo_quoted_3220406879" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Tuesday, November 20, 2018, 4:36:22 a.m. EST, Lukas Larsson <garazdawi@gmail.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv7823217333"><div><div dir="ltr">Hello,<br clear="none"><br clear="none"><div class="yiv7823217333gmail_quote"><div class="yiv7823217333yqt4131224284" id="yiv7823217333yqt56593"><div dir="ltr">On Mon, Nov 19, 2018 at 7:44 PM Vans S <<a rel="nofollow" shape="rect" ymailto="mailto:vans_163@yahoo.com" target="_blank" href="mailto:vans_163@yahoo.com">vans_163@yahoo.com</a>> wrote:<br clear="none"></div><blockquote class="yiv7823217333gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div>Currently there is no atomic function to update a ETS value when its not a tuple. For example if one of my ETS values is a map, and I want to put an element into the map, I have no atomic way to do so.<br clear="none"><br clear="none">Is there anyone else that really has a need for a function like :ets.update/3 where arg 1 is ets_table, 2 is key, 3 is fun callback that is called passing the original element and the reply should be the new element?</div></div></blockquote></div><div><br clear="none"></div><div>I've long wanted to do this for match specs, it would however be a huge undertaking to implement this. The main problem is what to do if the process runs out of reductions while doing the update.</div><div><br clear="none"></div><div>Should it be allowed to continue to run? and thus potentially starve other processes.</div><div>Should it be preempted? what do we then do with the locks on the ETS table?</div><div><br clear="none"></div><div>Lukas</div></div></div></div></div></div>
</div>
</div></body></html>