summaryrefslogtreecommitdiffstats
path: root/common/sched.c
blob: dcf6522ac0580a58dd326e4217f3571cdc004b83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* SPDX License Identifier: GPL-2.0 */

#include <bthread.h>
#include <poller.h>
#include <work.h>
#include <slice.h>
#include <sched.h>

void resched(void)
{
	bool run_workqueues = !slice_acquired(&command_slice);

	if (poller_active())
		return;

	command_slice_acquire();

	if (run_workqueues)
		wq_do_all_works();

	poller_call();

	command_slice_release();

	bthread_reschedule();
}