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

[Minios-devel] [UNIKRAFT PATCH 7/8] lib/uksched: Add function for killing threads


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Tue, 18 Sep 2018 18:27:28 +0300
  • Cc: felipe.huici@xxxxxxxxx, florian.schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
  • Delivery-date: Tue, 18 Sep 2018 15:27:42 +0000
  • Ironport-phdr: 9a23:dCb8NBeaDBHFeq/yiA/UfYIOlGMj4u6mDksu8pMizoh2WeGdxcWzYB7h7PlgxGXEQZ/co6odzbaO7Oa4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahY75+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM38H/ZhNF+gqxYpxyupRJ/zpXIbI2JLvdyYrnQcc8GSWdHQ81fVzZBAoS5b4YXEecBOv1Yr5X8p1sIsBCwAxSsBPvyyjRVgXL5wao60/89EQHH2gwsBdYOsGnMrNXoL6odTfu1wLPQzTXedPxawy396I/Rfx0nvPqCXqpwfNLMxUQgCg/JlFadpIz/Mz+LyOgAsXKX4uR4We6yhGMrtht9rzuvy8s2lIXEiIwYxkrZ+Sh23oo4I8CzRlRhbt6+CpRQsjmXN45xQsw/XW5loD06yrgauZ6jeygK1Ygnywbfa/OZd4iI5QruVPiUIThihXJlfKiziAqp8US60u38S9K73ExQripCitXMt3YN2ALP6sWfV/dw8Vqt1SyM2g3T8O1IP144mKjBJ5Mv2rIwk4AcsUXHHi/4gkX2i6qWe1049eiv8OTnfrTmppmGO49wlwH+Krkul9ejDuQjKAQOR3Wb9v+m2L35+k31WK9KgeEukqnFrJDaItwWpqu4Aw9T04Yj7A2/Ay6739sGg3kIMlZFdQmDj4joIFHOPOv4Ae2wgluyljdn3ffGPqfuAp/VNHjMjK/hfaph605b0Aczw85Q55ZVCrEZPv3/QE/xtMHZDhAlMgy52ODnB8th2YMaQ22AGbWVP73PsVWQ/OIgP/GMZJMJuDb6M/Ul6frujXgjmV8cZ6ap24EbaGukEfRmJkWZYGfjgssaHGcMoAUxUOjqh0eZXjJJeXmyQro25isnB4K+EYfDWoetjaSa3Ce6G51WYWZGBkqPEXf1aYqEXfYNZzyIIsJ6lDwLS6SuS4s72h61rgP11adnJPLO+iIErZLjyMR15+rLmBAy6Dx0FcWd33uTT2FzmmMHWz823KN4oUxj0VqD17Z3jOBcFdNJ/PxFSBk1NYOPh9B9XtXzXAPGZZKFRUirRv2iACotVZQhztlIZFxySPu4iRWW9C2xH74T35iWHIF8pqnbxGTwIYB51m7b/KI6yUE7SI1VMjv11eZE6wHPCtuRwA2inKGwePFE0Q==
  • 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>
---
 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 22c8913..c9da2fd 100644
--- a/lib/uksched/exportsyms.uk
+++ b/lib/uksched/exportsyms.uk
@@ -9,6 +9,7 @@ uk_sched_thread_create
 uk_sched_thread_destroy
 uk_sched_thread_sleep
 uk_sched_thread_exit
+uk_sched_thread_kill
 uk_thread_init
 uk_thread_fini
 uk_thread_block_timeout
diff --git a/lib/uksched/include/uk/sched.h b/lib/uksched/include/uk/sched.h
index c3e2866..5800c07 100644
--- a/lib/uksched/include/uk/sched.h
+++ b/lib/uksched/include/uk/sched.h
@@ -215,6 +215,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 3267ab2..4c4e037 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -68,8 +68,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 c5b7c9f..0e34552 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -228,6 +228,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 0a735bd..3b3a554 100644
--- a/lib/ukschedcoop/schedcoop.c
+++ b/lib/ukschedcoop/schedcoop.c
@@ -131,7 +131,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 3fd6a07..6f53e48 100644
--- a/plat/xen/xenbus/xs_comms.c
+++ b/plat/xen/xenbus/xs_comms.c
@@ -619,6 +619,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®.