Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task refcounting #41

Open
michaelsippel opened this issue Dec 7, 2023 · 0 comments
Open

Task refcounting #41

michaelsippel opened this issue Dec 7, 2023 · 0 comments

Comments

@michaelsippel
Copy link
Member

michaelsippel commented Dec 7, 2023

Tasks are handled by a plain pointer and destruction of a Task is controlled by Event::notify().
It uses an atomic count, a somewhat whacky refcount which only counts down on the two events which could ever possibly end the lifetime of a task: post_event or result_get_event.
(In case the result of a task needs to be kept in the future , because the value wasnt retrieved from the future yet)

However in delete_from_resources() and init_graph() there is still an additional lock required in order to avoid the creation of a dependency in the scheduling graph to some Task which is currently being destroyed. Adding proper refcounting to Tasks would deprecate the need for this spinlock.
It should be considered to avoid unneccesary increment/decrement on the atomic counter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant