This is an automated email from the ASF dual-hosted git repository. pkarashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 9d2dae2fd8b5b6848a9af1c39688e417e9a4503f Author: Xiang Xiao <[email protected]> AuthorDate: Thu May 19 01:09:34 2022 +0800 sched/wqueue: Add work_timeleft macro to get the left time to start Signed-off-by: Xiang Xiao <[email protected]> --- include/nuttx/wqueue.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/nuttx/wqueue.h b/include/nuttx/wqueue.h index bd91068748..5bdc25e22e 100644 --- a/include/nuttx/wqueue.h +++ b/include/nuttx/wqueue.h @@ -421,6 +421,29 @@ void work_foreach(int qid, work_foreach_t handler, FAR void *arg); #define work_available(work) ((work)->worker == NULL) +/**************************************************************************** + * Name: work_timeleft + * + * Description: + * This function returns the time remaining before the specified work + * start. + * + * Input Parameters: + * work - The work queue structure to check. + * + * Returned Value: + * The time in system ticks remaining until the work start. + * Zero means either that work is not valid or that work has already + * started. + * + ****************************************************************************/ + +#ifdef __KERNEL__ +# define work_timeleft(work) wd_gettime(&((work)->u.timer)) +#else +# define work_timeleft(work) ((sclock_t)((work)->u.s.qtime - clock())) +#endif + /**************************************************************************** * Name: lpwork_boostpriority *
