forked from nuttx/nuttx-update
sched/wqueue: fix work_notifier_setup() false failure
Be consistent with the datatype used for the 'key'. As the API in in the .h file uses int, I chose to replace uint32_t with int everywhere. This change ensures that work_notifier_setup() will not return a negative value indicating error to the caller, when in fact the notifier was correctly setup. This would happen when work_notifier_setup() had been called 0x8000000 times, and that many keys allocated.
This commit is contained in:
parent
561e1fc879
commit
fa841237dc
1 changed files with 5 additions and 5 deletions
|
@ -66,7 +66,7 @@ struct work_notifier_entry_s
|
|||
|
||||
/* Additional payload needed to manage the notification */
|
||||
|
||||
uint32_t key; /* Unique ID for the notification */
|
||||
int key; /* Unique ID for the notification */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -100,7 +100,7 @@ static dq_queue_t g_notifier_pending;
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static FAR struct work_notifier_entry_s *work_notifier_find(uint32_t key)
|
||||
static FAR struct work_notifier_entry_s *work_notifier_find(int key)
|
||||
{
|
||||
FAR struct work_notifier_entry_s *notifier;
|
||||
FAR dq_entry_t *entry;
|
||||
|
@ -134,11 +134,11 @@ static FAR struct work_notifier_entry_s *work_notifier_find(uint32_t key)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t work_notifier_key(void)
|
||||
static int work_notifier_key(void)
|
||||
{
|
||||
static uint32_t notifier_key;
|
||||
static int notifier_key;
|
||||
|
||||
if (++notifier_key == 0)
|
||||
if (++notifier_key <= 0)
|
||||
{
|
||||
notifier_key = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue