[riot-notifications] [RIOT-OS/RIOT] core: Added thread_signal & thread_await_signal (#11069)

Marian Buschsieweke notifications at github.com
Tue Feb 26 15:51:27 CET 2019

### Contribution description

`thread_sleep()` and `thread_wakeup()` provide simple means to signal an event to a thread. However, the calls need to be synchronized: The waiting thread has to call `thread_sleep()` before `thread_wakeup()` is called.

This commit adds `thread_await_signal()` and `thread_signal()` which do not need to be synchronized: If `thread_signal()` is called between to calls to `thread_await_signal()`, the second call to `thread_await_signal()` will return immediately. If `thread_await_signal()` is called before the matching call to `thread_signal()`, they will behave like `thread_wakeup()` and `thread_sleep()`.

### Testing procedure

As `thread_sleep()` and `thread_wakeup()` are changed to internally use `thread_await_signal()` and `thread_signal()`, testing if they still work should be done. `thread_await_signal()` and `thread_signal()` could be tested with https://github.com/RIOT-OS/RIOT/pull/10340, which I will update to use this PR after my next appointment. I could also provide a minimum example application using both APIs, if needed be.

### Issues/PRs references

Competes with https://github.com/RIOT-OS/RIOT/pull/11006
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * core: Added thread_signal & thread_await_signal

-- File Changes --

    M core/include/thread.h (61)

-- 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/20190226/7b7c99d1/attachment.html>

More information about the notifications mailing list