<h3>Contribution description</h3>
<p>This PR allows <code>thread_yield_higher()</code> to be called with IRQs disabled, on native. In that case, a deferred yield is executed once interrupts are re-enabled.</p>
<p>That's the behavior on Cortex-M. IMO it would be nice to be able to depend on it.</p>
<p>A test is added for verifying this behavior.<br>
The test verifies this behavior on all platforms though, and should thus be run on them.<br>
Should some platform not behave right, I suggest limiting the test to the working platforms, until this is sorted out.</p>

<h3>Testing procedure</h3>
<p>As this was warning and forbidden before, nothing should break. CI tests should be sufficient.</p>

<h3>Issues/PRs references</h3>
<p>The fix in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="972675011" data-permission-text="Title is private" data-url="https://github.com/RIOT-OS/RIOT/issues/16751" data-hovercard-type="pull_request" data-hovercard-url="/RIOT-OS/RIOT/pull/16751/hovercard" href="https://github.com/RIOT-OS/RIOT/pull/16751">#16751</a> could profit from this.</p>


<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/16754'>https://github.com/RIOT-OS/RIOT/pull/16754</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>cpu/native: defer yield when IRQs are disabled.</li>
  <li>tests/deferred_yield_higher: initial commit</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-59f7708725cf194de197aa3f9becf1b7079130efdc95a89da95c6bfb3c2ead3d">cpu/native/irq_cpu.c</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-88c4ae3bb559842e372346d3c938452210e2bdbc7411a08173942f48ca892c1f">cpu/native/native_cpu.c</a>
    (5)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-68efd633fb8aa9b2b599f85ffb463cde8ccc31f8dd881e4e5dd57d535a68b226">tests/deferred_yield_higher/Makefile</a>
    (3)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-345cb775e036f86107fa293093cee2ee768475474eea0df7db47954280873a91">tests/deferred_yield_higher/Makefile.ci</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-41deba10f7969d956639ccd311163dd8ac3310068d0effef75e2a160765f9167">tests/deferred_yield_higher/README.md</a>
    (14)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-d8d5db27c2d1dd429532f5c6624af067e67910c5445c02ad241c5d6f054a31a3">tests/deferred_yield_higher/main.c</a>
    (52)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16754/files#diff-7663e6a78ac986c233c175f193be0a9bb05eb7d68d325ae3f2dc01cf533d9276">tests/deferred_yield_higher/tests/test.py</a>
    (20)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16754.patch'>https://github.com/RIOT-OS/RIOT/pull/16754.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16754.diff'>https://github.com/RIOT-OS/RIOT/pull/16754.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16754">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYHHBEHFK3BONLCUXWDT5OCVFANCNFSM5CLXFAQA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email">Android</a>.<img src="https://github.com/notifications/beacon/ABE7WYENZ55P3COWMYMOWRDT5OCVFA5CNFSM5CLXFAQKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4OQGTHNQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16754",
"url": "https://github.com/RIOT-OS/RIOT/pull/16754",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>