summaryrefslogtreecommitdiff
path: root/linux/workqueue.c
diff options
context:
space:
mode:
authorJustin Husted <sigstop@gmail.com>2019-11-02 23:36:29 -0700
committerKent Overstreet <kent.overstreet@gmail.com>2019-11-03 23:17:43 -0500
commit97c6f602222543361380806224dc822d57134287 (patch)
treeba48f5a76272ad74ed979b1eb0af059649f11b2d /linux/workqueue.c
parentb20e16073546a32f925f839c2b4bf4da770ec3f8 (diff)
Stop workqueue threads at process exit time, to make valgrind happy.
Signed-off-by: Justin Husted <sigstop@gmail.com>
Diffstat (limited to 'linux/workqueue.c')
-rw-r--r--linux/workqueue.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/linux/workqueue.c b/linux/workqueue.c
index 4dfd6cd9..550cfd3b 100644
--- a/linux/workqueue.c
+++ b/linux/workqueue.c
@@ -307,3 +307,16 @@ static void wq_init(void)
BUG_ON(!system_wq || !system_highpri_wq || !system_long_wq ||
!system_unbound_wq || !system_freezable_wq);
}
+
+__attribute__((destructor(102)))
+static void wq_cleanup(void)
+{
+ destroy_workqueue(system_freezable_wq);
+ destroy_workqueue(system_unbound_wq);
+ destroy_workqueue(system_long_wq);
+ destroy_workqueue(system_highpri_wq);
+ destroy_workqueue(system_wq);
+
+ system_wq = system_highpri_wq = system_long_wq = system_unbound_wq =
+ system_freezable_wq = NULL;
+}