Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/common/linux Add work_pending, delayed_work...
details: https://anonhg.NetBSD.org/src/rev/5ba498baac0b
branches: trunk
changeset: 1027885:5ba498baac0b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 01:04:05 2021 +0000
description:
Add work_pending, delayed_work_pending.
diffstat:
sys/external/bsd/common/include/linux/workqueue.h | 6 +++-
sys/external/bsd/common/linux/linux_work.c | 29 +++++++++++++++++++++-
2 files changed, 32 insertions(+), 3 deletions(-)
diffs (95 lines):
diff -r 9747a96bb3e8 -r 5ba498baac0b sys/external/bsd/common/include/linux/workqueue.h
--- a/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 01:03:57 2021 +0000
+++ b/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 01:04:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: workqueue.h,v 1.16 2021/12/19 01:03:57 riastradh Exp $ */
+/* $NetBSD: workqueue.h,v 1.17 2021/12/19 01:04:05 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
#define cancel_work linux_cancel_work
#define cancel_work_sync linux_cancel_work_sync
#define current_work linux_current_work
+#define delayed_work_pending linux_delayed_work_pending
#define destroy_workqueue linux_destroy_workqueue
#define flush_delayed_work linux_flush_delayed_work
#define flush_scheduled_work linux_flush_scheduled_work
@@ -60,6 +61,7 @@
#define system_unbound_wq linux_system_unbound_wq
#define system_wq linux_system_wq
#define to_delayed_work linux_to_delayed_work
+#define work_pending linux_work_pending
struct workqueue_struct;
@@ -111,6 +113,7 @@
bool cancel_work(struct work_struct *);
bool cancel_work_sync(struct work_struct *);
bool flush_work(struct work_struct *);
+bool work_pending(struct work_struct *);
void INIT_DELAYED_WORK(struct delayed_work *,
void (*)(struct work_struct *));
@@ -122,6 +125,7 @@
bool cancel_delayed_work(struct delayed_work *);
bool cancel_delayed_work_sync(struct delayed_work *);
bool flush_delayed_work(struct delayed_work *);
+bool delayed_work_pending(struct delayed_work *);
struct work_struct *
current_work(void);
diff -r 9747a96bb3e8 -r 5ba498baac0b sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 01:03:57 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 01:04:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.48 2021/12/19 01:03:57 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.49 2021/12/19 01:04:05 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.48 2021/12/19 01:03:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.49 2021/12/19 01:04:05 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -538,6 +538,19 @@
}
/*
+ * work_pending(work)
+ *
+ * True if work is currently claimed by any workqueue, scheduled
+ * to run on that workqueue.
+ */
+bool
+work_pending(struct work_struct *work)
+{
+
+ return work->work_owner & 1;
+}
+
+/*
* work_queue(work)
*
* Return the last queue that work was queued on, or NULL if it
@@ -1526,3 +1539,15 @@
return waited;
}
+
+/*
+ * delayed_work_pending(dw)
+ *
+ * True if dw is currently scheduled to execute, false if not.
+ */
+bool
+delayed_work_pending(struct delayed_work *dw)
+{
+
+ return work_pending(&dw->work);
+}
Home |
Main Index |
Thread Index |
Old Index