<div dir="ltr">I like the ets:select_replace/2 function.<div><br></div><div>Of course, in the first case where I thought it might be useful, I ended up wishing for an extended version. ;-)</div><div><br></div><div><a href="https://github.com/uwiger/gproc/blob/master/src/gproc_pool.erl#L465">https://github.com/uwiger/gproc/blob/master/src/gproc_pool.erl#L465</a></div><div><br></div><div>The 'claim' operation performs a chunked select of workers in a given pool, and for each chunk of workers, tries to claim one by incrementing a counter value - if the value went from 0 to 1, the claim succeeded.</div><div><br></div><div>A select_replace() function could handle the atomic claim operation, but what I would want to do is to limit it to only one replace and to return the resulting object - not just the count. This could potentially be supported by a select_replace/3 function.</div><div><br></div><div>As far as I can recall, gproc_pool is competitive in terms of performance. Such an extended select_replace() function _should_ give a significant speedup, especially in the case of large busy pools (which possibly haven't been benchmarked.)<br><div><br></div><div>BR,</div><div>Ulf W</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-05-31 19:16 GMT+01:00 Kenneth Lundin <span dir="ltr"><<a href="mailto:kenneth@erlang.org" target="_blank">kenneth@erlang.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><h1>OTP 20 Release Candidate 2<br></h1>
<p>This is the second of two release candidates before the OTP 20
release. [...]</p></div></blockquote></div></div></div>