[riot-notifications] [RIOT-OS/RIOT] cpu/native: fix thread_yield_higher() with IRQs disabled (#16754)

Kaspar Schleiser notifications at github.com
Wed Aug 18 12:22:10 CEST 2021

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description

This PR allows `thread_yield_higher()` to be called with IRQs disabled, on native. In that case, a deferred yield is executed once interrupts are re-enabled.

That's the behavior on Cortex-M. IMO it would be nice to be able to depend on it.

A test is added for verifying this behavior.
The test verifies this behavior on all platforms though, and should thus be run on them.
Should some platform not behave right, I suggest limiting the test to the working platforms, until this is sorted out.

Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes

### Testing procedure

As this was warning and forbidden before, nothing should break. CI tests should be sufficient.

Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output

### Issues/PRs references

The fix in https://github.com/RIOT-OS/RIOT/pull/16751 could profit from this.
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * cpu/native: defer yield when IRQs are disabled.
  * tests/deferred_yield_higher: initial commit

-- File Changes --

    M cpu/native/irq_cpu.c (5)
    M cpu/native/native_cpu.c (5)
    A tests/deferred_yield_higher/Makefile (3)
    A tests/deferred_yield_higher/Makefile.ci (2)
    A tests/deferred_yield_higher/README.md (14)
    A tests/deferred_yield_higher/main.c (52)
    A tests/deferred_yield_higher/tests/test.py (20)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210818/d9d40a00/attachment-0001.htm>

More information about the notifications mailing list