summaryrefslogtreecommitdiffstats
path: root/common/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/sched.c')
-rw-r--r--common/sched.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/common/sched.c b/common/sched.c
new file mode 100644
index 0000000000..dcf6522ac0
--- /dev/null
+++ b/common/sched.c
@@ -0,0 +1,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();
+}