Skip to content

Commit

Permalink
resource: add comment about possible problem with sid_resource_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
prajnoha committed Sep 26, 2022
1 parent 860764e commit 33030e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/resource/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@ int sid_resource_unref(sid_resource_t *res)
return 0;
}

/*
* FIXME: Add sid_resource_ref_from_resource(sid_resource_t *current_res, sid_resource_t *res)
* that checks if current_res is not below res in a resource tree. If that
* happens, we can get into a problem - we are moving on to recursive children traversal
* for unref only if a resource count drops to 0. So the refence from any resource below
* would never get unreffed. The same check also needs to be a part of sid_resource_add_child
* somehow - but for that we'd need to track all the refs that a resource has made
* to other resources.
*/
sid_resource_t *sid_resource_ref(sid_resource_t *res)
{
if (res)
Expand Down

0 comments on commit 33030e9

Please sign in to comment.