[riot-devel] [RIOT] low hanging warnings fruits (#62)
kaspar at schleiser.de
Tue Jul 2 16:21:48 CEST 2013
On 06/30/2013 02:45 PM, Oleg wrote:
> |mutex.c:94:46: warning: unused parameter 'yield' [-Wunused-parameter]
> void mutex_unlock(struct mutex_t *mutex, int yield)|
> Maybe deprecated.
Lets think this through. I checked the history, we actually honoured
that flag before.
This parameter allows control over the yield behavior on mutex
unlocking, e.g., whether a task switch is forced within mutex_unlock or
not. This saves context switches if you have to release more than one
mutex before yielding, or whether you just want to notify a
lower-priority thread, but have work to do before. With our scheduling
policy in mind, this only makes sense for other threads with the same
1. We unlock, only lower threads waiting -> yield comes right back.
2. We unlock, only higher threads waiting -> scheduling policy requires
3. We unlock, other thread with same priority waiting -> we wouldn't
yield unless forced, but we have to do the check for higher priority
So I guess you're right, the parameter is obsolete. Intended behaviour
can be replicated by explicitly calling sched_yield() after mutex_unlock().
We should not remove the parameter before the next major version as the
change breaks the API.
Am I wrong?
More information about the devel