From b19d08b30f8039dc35358a80277551e283d18e35 Mon Sep 17 00:00:00 2001 From: deadwood Date: Sat, 28 Sep 2013 19:09:01 +0000 Subject: [PATCH] Add TODO - how to solve the clearing of tls (port from V0) git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@48167 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/mesa/src/aros/tls.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/workbench/libs/mesa/src/aros/tls.c b/workbench/libs/mesa/src/aros/tls.c index 265f88b3c4..69b3567b8f 100644 --- a/workbench/libs/mesa/src/aros/tls.c +++ b/workbench/libs/mesa/src/aros/tls.c @@ -80,6 +80,19 @@ VOID ClearFromTLS(struct TaskLocalStorage * tls) /* Clearing is inserting a NULL. Element can't be removed from list - since there is no read locking, altering structure of list when other tasks are reading it, would cause crashes */ + /* TODO: How real clearing can be achieved: + * a) acquire write lock + * b) copy all element (copy not relink!) from _current list to _new list except for the element that + * is beeing cleared + * c) _old = _current, _current = _new + * d) release write lock + * + * How to delete _old? It can't be deleted right away, because some read tasks can be iterating over it. + * a) put it on garbage collect list (the whole list, not relinking nodes!) and clear it when shutting down + * b) use memory pool to allocate all TLS objects and clear pool at shutdown + * + * Solution b is much easier and convenient + */ InsertIntoTLS(tls, NULL); } -- 2.11.4.GIT