Main Content

eventReleaseResource

Class: matlab.DiscreteEventSystem
Package: matlab

Create an event to release previously acquired resources

Syntax

event = eventReleaseResource(resourceSpec,tag)

Description

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 resourceSpecification.

If the amount of resources to be released is larger than the previously acquired resources, then all the resources are released.

Input Arguments

expand all

Specify the name and the amount of resources to be released by the entities.

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.

Output Arguments

expand all

Event that releases resources from the entity.

Examples

expand all

On entity entry to a storage element, an entity releases one resource of type Test1. The tag of this resource acquisition event is myTag.

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