1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core: thread_flags: optimize thread_flags_wait_one, fix doxygen

This commit is contained in:
Kaspar Schleiser 2016-03-30 12:49:21 +02:00
parent 5f81284270
commit 46143c6bdc
2 changed files with 5 additions and 3 deletions

View File

@ -124,7 +124,7 @@ thread_flags_t thread_flags_wait_all(thread_flags_t mask);
* @brief Wait for any flags in mask to become set (blocking), one at a time
*
* This function is like thread_flags_wait_any(), but will only clear and return
* one flag at a time, most significant set bit first.
* one flag at a time, least significant set bit first.
*
* @param[in] mask mask of flags to wait for
*

View File

@ -79,8 +79,10 @@ thread_flags_t thread_flags_wait_one(thread_flags_t mask)
{
_thread_flags_wait_any(mask);
thread_t *me = (thread_t*) sched_active_thread;
unsigned tmp = me->flags & mask;
return _thread_flags_clear_atomic(me, thread_flags_clear(1 << bitarithm_lsb(tmp)));
thread_flags_t tmp = me->flags & mask;
/* clear all but least significant bit */
tmp &= (~tmp + 1);
return _thread_flags_clear_atomic(me, tmp);
}
thread_flags_t thread_flags_wait_all(thread_flags_t mask)