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

Kaspar Schleiser notifications at github.com
Wed Feb 13 10:46:22 CET 2019


> Yes. Also an event queue and likely a cond could be used for that when investing significant work and paying more overhead. The point is that this approach is more lightweight in the backend and requires less code to be written to use it for its use case.

"This commit adds thread_await_signal() and thread_signal() which do not need to be synchronized: If thread_signal() is called between two 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()."

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

Is this accurate? On first sight to me (who designed msg, mbox, event, thread_flags and mutex in RIOT) it is, so IMO before adding another synchronization primitive, we need more details.

> I think that unlocking a mutex from ISR that was locked in thread context would work technicality in RIOT. I have not looked at that. But the concept of a mutex does not allow it to be unlocked from a different context than it was locked. So even if abusing the mutex for this would work here, it will make future changes of the mutex internals very difficult, when not only legitimate users but also abusers of the API need to be taken in mind.

If I'd known that "mutex" will carry this stigma... At some point in time, we need to s/mutex/lock/ throughout RIOT. Anyhow, if we have code that does something but is named wrong, we do not introduce new, different code with another name that does the same but differently.

Please, more details. I actually like the API. I just don't get it fully yet.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11006#issuecomment-463130733
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190213/8948e3a3/attachment.html>


More information about the notifications mailing list