Create an event to release previously acquired resources
event = eventReleaseResource(resourceSpec,tag)
creates an event for entities to release previously acquired resources. You can specify the
type and amount of resources to release. For more details, see
event = eventReleaseResource(
If the amount of resources to be released is larger than the previously acquired resources, then all the resources are released.
resourceSpec — Specify name and amount of resources for release
array of MATLAB® structures
Specify the name and the amount of resources to be released by the entities.
tag — Identifier tag for the resource release event
Custom tag of this entity resource release event. You can use the tag to identify an event when multiple events act on the same entity. For more information about managing multiple events, see Custom Entity Storage Block with Multiple Timer Events.
event — Resource release event
Event that releases resources from the entity.
Acquire Resources on Entry
On entity entry to a storage element, an entity releases one resource
Test1. The tag of this resource acquisition event is
function [entity,events] = entry(obj, storage, entity, source) % On entity entry, release a resource from the specified pool. resourceSpec = obj.resourceSpecification('Test1', 1); event = obj.eventReleaseResource(resourceSpec, 'myTag'); end
Introduced in R2019a