workqueue: add work_foreach support

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2022-01-24 18:17:50 +08:00
committed by Xiang Xiao
parent b53bbb15c5
commit d09be7d658
3 changed files with 72 additions and 4 deletions
+23
View File
@@ -292,6 +292,10 @@ struct work_notifier_s
worker_t worker; /* The worker function to schedule */
};
/* This is the callback type used by work_foreach() */
typedef CODE void (*work_foreach_t)(int tid, FAR void *arg);
/****************************************************************************
* Public Data
****************************************************************************/
@@ -381,6 +385,25 @@ int work_queue(int qid, FAR struct work_s *work, worker_t worker,
int work_cancel(int qid, FAR struct work_s *work);
/****************************************************************************
* Name: work_foreach
*
* Description:
* Enumerate over each work thread and provide the tid of each task to a
* user callback functions.
*
* Input Parameters:
* qid - The work queue ID
* handler - The function to be called with the pid of each task
* arg - The function callback
*
* Returned Value:
* None
*
****************************************************************************/
void work_foreach(int qid, work_foreach_t handler, FAR void *arg);
/****************************************************************************
* Name: work_available
*