[riot-notifications] [RIOT-OS/RIOT] core: Added thread_signal & thread_await_signal (#11069)
notifications at github.com
Wed Mar 13 10:20:33 CET 2019
Two more arguments for inclusion:
1. This API is easier to understand and use instead of using a mutex/lock for this specific use case. It is not obvious that an API intended to be used to prevent data races can be used for synchronization. This is clearly shown by the fact that other developers resort to using `thread_flags` instead when it is an overkill.
2. Let's assume future work will try to optimize out the overhead of locks/mutexs in cases when only a single thread (when not counting the idle thread) is used. In that scenario a call to `mutex_lock()` and `mutex_unlock()` could be replaced by a basically empty static inline function, as there is no need protect data structures from data races. But the scenario that abuses the mutex/lock for synchronization will no longer work then.
Even though argument 2 is hypothetical, it shows quite clearly that synchronization and mutual exclusion are two distinct things calling for two distinct APIs. If they have under the hood the same implementation, this is an internal implementation detail.
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...
More information about the notifications