mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 18:50:39 +00:00
lib: Fixup workqueue.c to use proper thread.h semantics
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
71623b304e
commit
d1c276681f
@ -103,8 +103,7 @@ void work_queue_free_and_null(struct work_queue **wqp)
|
|||||||
{
|
{
|
||||||
struct work_queue *wq = *wqp;
|
struct work_queue *wq = *wqp;
|
||||||
|
|
||||||
if (wq->thread != NULL)
|
THREAD_OFF(wq->thread);
|
||||||
thread_cancel(&(wq->thread));
|
|
||||||
|
|
||||||
while (!work_queue_empty(wq)) {
|
while (!work_queue_empty(wq)) {
|
||||||
struct work_queue_item *item = work_queue_last_item(wq);
|
struct work_queue_item *item = work_queue_last_item(wq);
|
||||||
@ -122,16 +121,14 @@ void work_queue_free_and_null(struct work_queue **wqp)
|
|||||||
|
|
||||||
bool work_queue_is_scheduled(struct work_queue *wq)
|
bool work_queue_is_scheduled(struct work_queue *wq)
|
||||||
{
|
{
|
||||||
return (wq->thread != NULL);
|
return thread_is_scheduled(wq->thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int work_queue_schedule(struct work_queue *wq, unsigned int delay)
|
static int work_queue_schedule(struct work_queue *wq, unsigned int delay)
|
||||||
{
|
{
|
||||||
/* if appropriate, schedule work queue thread */
|
/* if appropriate, schedule work queue thread */
|
||||||
if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && (wq->thread == NULL)
|
if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) &&
|
||||||
&& !work_queue_empty(wq)) {
|
!thread_is_scheduled(wq->thread) && !work_queue_empty(wq)) {
|
||||||
wq->thread = NULL;
|
|
||||||
|
|
||||||
/* Schedule timer if there's a delay, otherwise just schedule
|
/* Schedule timer if there's a delay, otherwise just schedule
|
||||||
* as an 'event'
|
* as an 'event'
|
||||||
*/
|
*/
|
||||||
@ -144,7 +141,8 @@ static int work_queue_schedule(struct work_queue *wq, unsigned int delay)
|
|||||||
&wq->thread);
|
&wq->thread);
|
||||||
|
|
||||||
/* set thread yield time, if needed */
|
/* set thread yield time, if needed */
|
||||||
if (wq->thread && wq->spec.yield != THREAD_YIELD_TIME_SLOT)
|
if (thread_is_scheduled(wq->thread) &&
|
||||||
|
wq->spec.yield != THREAD_YIELD_TIME_SLOT)
|
||||||
thread_set_yield_time(wq->thread, wq->spec.yield);
|
thread_set_yield_time(wq->thread, wq->spec.yield);
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
@ -215,10 +213,7 @@ void workqueue_cmd_init(void)
|
|||||||
*/
|
*/
|
||||||
void work_queue_plug(struct work_queue *wq)
|
void work_queue_plug(struct work_queue *wq)
|
||||||
{
|
{
|
||||||
if (wq->thread)
|
THREAD_OFF(wq->thread);
|
||||||
thread_cancel(&(wq->thread));
|
|
||||||
|
|
||||||
wq->thread = NULL;
|
|
||||||
|
|
||||||
UNSET_FLAG(wq->flags, WQ_UNPLUGGED);
|
UNSET_FLAG(wq->flags, WQ_UNPLUGGED);
|
||||||
}
|
}
|
||||||
@ -250,8 +245,6 @@ void work_queue_run(struct thread *thread)
|
|||||||
|
|
||||||
assert(wq);
|
assert(wq);
|
||||||
|
|
||||||
wq->thread = NULL;
|
|
||||||
|
|
||||||
/* calculate cycle granularity:
|
/* calculate cycle granularity:
|
||||||
* list iteration == 1 run
|
* list iteration == 1 run
|
||||||
* listnode processing == 1 cycle
|
* listnode processing == 1 cycle
|
||||||
|
Loading…
Reference in New Issue
Block a user