]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Stop workqueue threads at process exit time, to make valgrind happy.
authorJustin Husted <sigstop@gmail.com>
Sun, 3 Nov 2019 06:36:29 +0000 (23:36 -0700)
committerKent Overstreet <kent.overstreet@gmail.com>
Mon, 4 Nov 2019 04:17:43 +0000 (23:17 -0500)
Signed-off-by: Justin Husted <sigstop@gmail.com>
linux/workqueue.c

index 4dfd6cd9e2099ad4db1d7c109f07fb0f91bb40af..550cfd3b5e5f76d3cf6a8cad9ecd81b74e195722 100644 (file)
@@ -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;
+}