mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
wqueue: fix work_qcancel() judge error caused by the union in struct work_s
in struct work_s:
union
{
struct
{
struct dq_entry_s dq; /* Implements a double linked list */
clock_t qtime; /* Time work queued */
} s;
struct wdog_s timer; /* Delay expiry timer */
}
while we use WDOG_ISACTIVE(&work->timer) to decide use dq or timer,
that is error, wd_cancel() maybe modify this area, dq_rem() also can
modify this area.
So we can't use the WDOG_ISACTIVE(&work->timer) to take as the judgement,
when there is a union.
Fix:
swap the order in struct wdog_s, move the arg to the second 32bit
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -61,17 +61,22 @@ typedef uint32_t wdparm_t;
|
||||
|
||||
typedef CODE void (*wdentry_t)(wdparm_t arg);
|
||||
|
||||
/* This is the internal representation of the watchdog timer structure. */
|
||||
/* This is the internal representation of the watchdog timer structure.
|
||||
* Notice !!!
|
||||
* Carefully with the struct wdog_s order, you may not directly modify
|
||||
* this. This struct will combine in struct work_s in union type, and,
|
||||
* wqueue will modify/check this struct in kwork work_qcancel().
|
||||
*/
|
||||
|
||||
struct wdog_s
|
||||
{
|
||||
FAR struct wdog_s *next; /* Support for singly linked lists. */
|
||||
wdparm_t arg; /* Callback argument */
|
||||
wdentry_t func; /* Function to execute when delay expires */
|
||||
#ifdef CONFIG_PIC
|
||||
FAR void *picbase; /* PIC base address */
|
||||
#endif
|
||||
sclock_t lag; /* Timer associated with the delay */
|
||||
wdparm_t arg; /* Callback argument */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user