<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Seems you misunderstood my question. It was *not* what is best to
do. It was: "Does the core-libs team have a common-sense / best
practice for busy-wait.". The latter is a clear and concise
question, and the answer could be as simple as "yes" or "no".<br>
</p>
<div class="moz-cite-prefix">Am 15.06.2025 um 18:40 schrieb Archie
Cobbs:<br>
</div>
<blockquote type="cite"
cite="mid:CANSoFxtKJkQbFsq5+gmdDb=cQ_7pv=ZGJGqV_XZ0FxFyX5wX9g@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Just MHO... </div>
<div><br>
</div>
<div>This is kind of like asking "What's the best way to waste
electricity?"</div>
<div><br>
</div>
<div>It's a nebulous question until you specify what "best"
means in this odd scenario.... </div>
<div><br>
</div>
<div>-Archie</div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Sun, Jun 15, 2025 at
11:09 AM Markus KARG <<a
href="mailto:markus@headcrashing.eu" moz-do-not-send="true"
class="moz-txt-link-freetext">markus@headcrashing.eu</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Recently
I was asked by a programmer, what to do if there simply is no
<br>
other way than actually busy-wait.<br>
<br>
I see several options:<br>
<br>
* Do nothing: Costs valuable CPU time and increases carbon
footprint.<br>
<br>
* Do a power-nap: Thread.sleep(1)<br>
<br>
* Be fair: Thread.yield() gives other threads a chance to
execute in <br>
this time slot.<br>
<br>
* Be eco-friendly: Thread.onSpinWait() could reduce carbon
footprint.<br>
<br>
* A combination of that, like "Thread.yield();
Thread.onSpinWait();"<br>
<br>
As all of that has its pros and cons, and as all of that works
<br>
differently on each hardware platform, I do wonder if there is
some <br>
common sense / best practice for busy wait (other than
"Replace it using <br>
async") in the core-libs team?<br>
<br>
Thanks!<br>
<br>
-Markus<br>
<br>
<br>
<br>
</blockquote>
</div>
<div><br clear="all">
</div>
<br>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
</div>
</blockquote>
</body>
</html>