Skip to content

Commit 7511766

Browse files
committed
[resource_manager] add notice remove_resource
add a notice to remove_resource that discusses thread-safety concerns
1 parent c85042b commit 7511766

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/le_resource_manager/le_resource_manager.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct le_image_decoder_format_o {
2424

2525
// ----------------------------------------------------------------------
2626
// TODO:
27-
// * add a method to remove resources from the manager
27+
// * add a method to safely remove resources from the manager
2828
// * add a method to update resources from within the manager
2929
// ----------------------------------------------------------------------
3030

@@ -452,12 +452,15 @@ static void le_resource_manager_add_item( le_resource_manager_o* self,
452452

453453
static bool le_resource_manager_remove_item( le_resource_manager_o* self, le_img_resource_handle const* resource_handle ) {
454454

455-
// TODO: you must be careful not to remove an item that might still be used for a transfer
456-
// you might want to tap into the backend's on_fence_reached callback to only remove resources
457-
// once we can be sure that there is no more dependency on them.
455+
// TODO
456+
// SAFETY: As soon as the le_command_buffer recording phase has completed,
457+
// we can dispose of any items from self->resources that were referenced
458+
// up to this point.
458459
//
459-
// Although for now we assume that the recording step of our pipeline always happens on the same thread as the
460-
// thread that declares the rendergraph.
460+
// This means that we should protect any resources that are currently being
461+
// uploaded by keeping them until the recording step has been completed.
462+
//
463+
// Until this is implemented, we should not consider this method safe.
461464

462465
auto it = self->resources.find( *resource_handle );
463466

0 commit comments

Comments
 (0)