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

[Minios-devel] [UNIKRAFT PATCH 1/8] lib/uknetdev: Destroy dispatcher thread using public scheduling API


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Tue, 23 Apr 2019 13:41:37 +0300
  • Cc: felipe.huici@xxxxxxxxx, Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Tue, 23 Apr 2019 10:42:02 +0000
  • Ironport-phdr: 9a23:m5VsuhXO7oLxQd/Xczheor5eMojV8LGtZVwlr6E/grcLSJyIuqrYZRWHuqdThVPEFb/W9+hDw7KP9fy5ACpcsd3b6ThCKMUKC0Zdz51O3kQJO42sMQXDNvnkbig3ToxpdWRO2DWFC3VTA9v0fFbIo3e/vnY4ExT7MhdpdKyuQtaBx8u42Pqv9JLNfg5GmCSyYa9oLBWxsA7dqtQajZFtJ6os1xfFuHRFdudZyW92OF6YghLw6tut8JJ5/Clcpu4t+9RcXanmeqgzUKBVAikhP20p/sPgqAPNTRGI5nsSU2UWlgRHDg3Y5xzkXZn/rzX3uPNl1CaVIcP5Q7Y0WS+/76hwUx/nlD0HNz8i/27JjMF7kb9Wrwigpxx7xI7UfZ2VOf9jda7TYd8WWWxMVdtXWidcAI2zcpEPAvIBM+hGsofzqVgAoxy8CgmiH+7j1iNEi2Xq0aAgz+gtDQfL1xEgEdIUt3TUqc34ObkVUeCu0KnIzDPDZO5Q1zfg8IjIbw0qrPaQUrJ3asrR1UgvFwXfglWUtIzlJy6V2/8RvGiA9eZgTf+vhHU9pwFrpTii38EhgZTKiIIN0l3I6Cp0zJsvKdC7SEN3e8CoHIVSui2AOYZ6Wt4uTm51tCogybALuYS3cDYExZkp3RLTdvOKf5aO7xn+TuieOy14i2hgeL+nghay9lWvxfPkW8mv1VZKsjJFkt7RtnARzxDT6taISv96/kq5xzaP0hrc6uBAIUwuiaXbMIQtwqYtlpUIq0jDBCj2lF33jK+QaEok5vCl5/nob7n7vJORNI95hhvgPqgwmMGzG+o1PhALX2eB+OS80LPj/Vf+QLVPlvA5jq7ZsIvGJcQaoK61GQtV0ps76xaiFDqpzM8YkWMfLFJYYx2LlZLpO1bWLPDiEfi/m0iskCtsx/3eO73hA5PNLnnEkLf6ZLpy9lBTyBQtwtBb/J9UDrABIOnvWk/qrtDZAQE2Mwquz+bgEtV92ZsUWXiTDa+BLKPSrViI6/ovLemIY48Vojf9JOIj5/L0kHE2hV8dfayo3ZQKdHC1BfJmLFuFbnromNgOCn0GsRQjTObykl2NTSZTZ2quX6I7/jw7BpypDYPCRoC1nrONxie7HoBXZm9aC1CBCnHoeJuYVPcIci2dOdVtnSIZVbK5UY8uyQmutBPmy7pgNufU4S0Yuoj51Ndv4e3fjwoy+iZyD8SB02GCVWd0kXkNRzIt2qBwv1ByylOZ3qdjmfBXC8FT7etTUggmLZ7c0/B6C9fqVwLaf9eJTVGmQtO8DTEyU9I+3dkOYkdjFNW4lR3D2TSlDKMRl7ORH5M46LzT32XpLcZn13nGzLUhj0UhQsZXNWymm7R/9wnJC47XlEWZk7qldaQf3C7K6meO1myOs19EXw50S6rKRmoTaVXLrYex2kSXSr6oCLM8dwdM18OGAq9LccHyy0VLQrHkItuNTXi2njKbAg2Ux7XESJfyZi1J1yLGFEkC1QQO5WuuPhN4Hjqr5XjZWm89XWnzal/hpLEt4EiwSVU5mlmH
  • Ironport-sdr: yJgkB6A9HOPGbjJd9dwGRd6//ad1AGyX+q4Or4QWZL06ejUuGvoO0VquCpsQ12DlrPMw/fDre6 B74cu3Q+iu2g==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

When thread destruction is wanted, one should kill the thread and wait
for it in order to free its resources. uk_sched_thread_destroy() is not
part of public scheduling API.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uknetdev/netdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/uknetdev/netdev.c b/lib/uknetdev/netdev.c
index cda8a82b..90ecd0a4 100644
--- a/lib/uknetdev/netdev.c
+++ b/lib/uknetdev/netdev.c
@@ -311,8 +311,10 @@ static void _destroy_event_handler(struct 
uk_netdev_event_handler *h
 #ifdef CONFIG_LIBUKNETDEV_DISPATCHERTHREADS
        UK_ASSERT(h->dispatcher_s);
 
-       if (h->dispatcher)
-               uk_sched_thread_destroy(h->dispatcher_s, h->dispatcher);
+       if (h->dispatcher) {
+               uk_thread_kill(h->dispatcher);
+               uk_thread_wait(h->dispatcher);
+       }
        h->dispatcher = NULL;
 
        if (h->dispatcher_name)
-- 
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®.