[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v4 07/12] lib/uksched: Add function for killing threads


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Fri, 22 Mar 2019 16:16:34 +0200
  • Cc: Florian.Schmidt@xxxxxxxxx
  • Delivery-date: Fri, 22 Mar 2019 14:16:51 +0000
  • Ironport-phdr: 9a23:lW/LtRV6ZU0fHSCQbGBQDf1NaWPV8LGtZVwlr6E/grcLSJyIuqrYbBWOt8tkgFKBZ4jH8fUM07OQ7/m4HzNZqsve+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAiqoQnLtMQanIRuJ6YzxxDUvnZGZuNayH9yK1mOhRj8/MCw/JBi8yRUpf0s8tNLXLv5caolU7FWFSwqPG8p6sLlsxnDVhaP6WAHUmoKiBpIAhPK4w/8U5zsryb1rOt92C2dPc3rUbA5XCmp4ql3RBP0jioMKjg0+3zVhMNtlqJWuBKvqQJizYDaY4+bM/hxfq3GcN8GWWZMRNpdWjZdDo+gaYYEEuoPPfxfr4n4v1YDsxy+BRKwBOPuzD9Dm3n43bAi0+Q8DArL2xAvH9UVsHTIrdX1Mr0eUeSozKnQ0DXOdO9Z2Szn5IjQbxAuuuuAXah3ccfIz0QkCgDLjk2IpID4MD6Zy/4Bvmub4uZ6S+6jlWwqpxt/rzS328shhZTFipgWx13E7yl13og4KNOiREJmbtOoDp1dvDyAOYRsWMMtWWRotT4/yr0BpJG0YjAHyI8ixx7Dc/yHdJWI4g77WOaRPzh4gHVldaqhhxa360egy+n8WtOo31ZRtCZFisTMuWsX2xzJ7ciLUvp9/kG/1jaTzw3f9+5JLV0umafYK5Mt2KA8moQRvEjZECL6gED2g7WXdkUg9Oio8ePnYrD+q5CAMI90kR3+MqUomsClBeQ4LxAOX3WA9Ougz73v51X5QKhRgfEsiKnZt4jWJd4Hqa6hHw9VzoEj5g66Dzen1tQYnH4HLElcdB2akYfpJU/BIPTjAPe7glSsiytrx+vcMrzuHJrNKGLPkLD7fbZy80Rc0hY8zchD55JIDbEMOPL9Wkv2tNzCDx82KQq0z/z6Btph1oMeXGOPDbKFMK7Jt1+H+P4gI+2Wa4AOojryNeUltLbSiio8mFkcerLs0ZYJZXSQGvV9P17fcXfqxNAbHjQkpA07Gcftk0GDV3Z3em6vF/Y34SonCYTgCZrbW6imm/qZwS39BJoANTMOMUyFDXq9L9bMYPwLci/HesI=
  • Ironport-sdr: tGFRgKeUuopJ0P+ntAif9RJkI9w1aX/2SiRMFX6f69aCMD2pTwxiaC5twQ7mTdh8L82L9Gd7j1 JL3BxDB9YvZg==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Thread kill function replaces the thread destroy function as the
public function for triggering thread deaths.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 lib/uksched/exportsyms.uk       | 1 +
 lib/uksched/include/uk/sched.h  | 2 ++
 lib/uksched/include/uk/thread.h | 4 ++--
 lib/uksched/sched.c             | 5 +++++
 lib/ukschedcoop/schedcoop.c     | 2 +-
 plat/xen/xenbus/xs_comms.c      | 2 +-
 6 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/uksched/exportsyms.uk b/lib/uksched/exportsyms.uk
index 3118383d..c67892c4 100644
--- a/lib/uksched/exportsyms.uk
+++ b/lib/uksched/exportsyms.uk
@@ -7,6 +7,7 @@ uk_sched_start
 uk_sched_idle_init
 uk_sched_thread_create
 uk_sched_thread_destroy
+uk_sched_thread_kill
 uk_sched_thread_sleep
 uk_sched_thread_exit
 uk_thread_init
diff --git a/lib/uksched/include/uk/sched.h b/lib/uksched/include/uk/sched.h
index e5630ed6..9e218688 100644
--- a/lib/uksched/include/uk/sched.h
+++ b/lib/uksched/include/uk/sched.h
@@ -217,6 +217,8 @@ struct uk_thread *uk_sched_thread_create(struct uk_sched 
*sched,
                void (*function)(void *), void *arg);
 void uk_sched_thread_destroy(struct uk_sched *sched,
                struct uk_thread *thread);
+void uk_sched_thread_kill(struct uk_sched *sched,
+               struct uk_thread *thread);
 
 static inline
 void uk_sched_thread_switch(struct uk_sched *sched,
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index 131268b4..f3891c29 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -69,8 +69,8 @@ UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);
                        name, attr, function, data)
 #define uk_thread_create(name, function, data) \
        uk_thread_create_attr(name, NULL, function, data)
-#define uk_thread_destroy(thread) \
-       uk_sched_thread_destroy(thread->sched, thread)
+#define uk_thread_kill(thread) \
+       uk_sched_thread_kill(thread->sched, thread)
 void uk_thread_exit(struct uk_thread *thread);
 
 int uk_thread_wait(struct uk_thread *thread);
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
index a0d706f5..5f6bc685 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -222,6 +222,11 @@ void uk_sched_thread_destroy(struct uk_sched *sched, 
struct uk_thread *thread)
        uk_free(sched->allocator, thread);
 }
 
+void uk_sched_thread_kill(struct uk_sched *sched, struct uk_thread *thread)
+{
+       uk_sched_thread_remove(sched, thread);
+}
+
 void uk_sched_thread_sleep(__nsec nsec)
 {
        struct uk_thread *thread;
diff --git a/lib/ukschedcoop/schedcoop.c b/lib/ukschedcoop/schedcoop.c
index 2a646760..a3f265c6 100644
--- a/lib/ukschedcoop/schedcoop.c
+++ b/lib/ukschedcoop/schedcoop.c
@@ -128,7 +128,7 @@ static void schedcoop_schedule(struct uk_sched *s)
                        continue;
 
                if (thread != prev)
-                       uk_thread_destroy(thread);
+                       uk_sched_thread_destroy(s, thread);
        }
 }
 
diff --git a/plat/xen/xenbus/xs_comms.c b/plat/xen/xenbus/xs_comms.c
index 0589d48b..5c393c1e 100644
--- a/plat/xen/xenbus/xs_comms.c
+++ b/plat/xen/xenbus/xs_comms.c
@@ -617,6 +617,6 @@ void xs_comms_fini(void)
        xsh.buf = NULL;
 
        /* TODO stop thread, instead of killing it */
-       uk_thread_destroy(xsh.thread);
+       uk_thread_kill(xsh.thread);
        xsh.thread = NULL;
 }
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.