API
ConcurrentSim.ConcurrentSim
— ModuleMain module for ConcurrentSim.jl – a discrete event process oriented simulation framework for Julia.
ConcurrentSim.Container
— TypeContainer{N<:Real, T<:Number}(env::Environment, capacity::N=one(N); level::N=zero(N))
A "Container" resource object, storing up to capacity
units of a resource (of type N
).
There is a Resource
alias for Container{Int, Int}
.
Resource()
with default capacity of 1
is very similar to a typical lock. The lock
and unlock
functions are a convenient way to interact with such a "lock", in a way mostly compatible with other discrete event and concurrency frameworks. The request
and release
aliases are also available for these two functions.
See Store
for a more channel-like resource.
Think of Resource
and Container
as locks and of Store
as channels. They block only if empty (on taking) or full (on storing).
ConcurrentSim.DelayQueue
— TypeDelayQueue{T}
A queue in which items are stored in a FIFO order, but are only available after a delay.
julia> sim = Simulation()
+API · ConcurrentSim API
ConcurrentSim.ConcurrentSim
— ModuleMain module for ConcurrentSim.jl – a discrete event process oriented simulation framework for Julia.
sourceConcurrentSim.Container
— TypeContainer{N<:Real, T<:Number}(env::Environment, capacity::N=one(N); level::N=zero(N))
A "Container" resource object, storing up to capacity
units of a resource (of type N
).
There is a Resource
alias for Container{Int, Int}
.
Resource()
with default capacity of 1
is very similar to a typical lock. The lock
and unlock
functions are a convenient way to interact with such a "lock", in a way mostly compatible with other discrete event and concurrency frameworks. The request
and release
aliases are also available for these two functions.
See Store
for a more channel-like resource.
Think of Resource
and Container
as locks and of Store
as channels. They block only if empty (on taking) or full (on storing).
sourceConcurrentSim.DelayQueue
— TypeDelayQueue{T}
A queue in which items are stored in a FIFO order, but are only available after a delay.
julia> sim = Simulation()
queue = DelayQueue{Symbol}(sim, 10)
@resumable function producer(env, queue)
for item in [:a,:b,:a,:c]
@@ -25,7 +25,7 @@
[ Info: taking a at time 10.0
[ Info: taking b at time 12.0
[ Info: taking a at time 14.0
-[ Info: taking c at time 16.0
sourceConcurrentSim.QueueStore
— TypeQueueStore{N, T<:Number}
A store in which items are stored in a FIFO order.
julia> sim = Simulation()
+[ Info: taking c at time 16.0
sourceConcurrentSim.QueueStore
— TypeQueueStore{N, T<:Number}
A store in which items are stored in a FIFO order.
julia> sim = Simulation()
store = Store{Symbol}(sim)
queue = QueueStore{Symbol}(sim)
items = [:a,:b,:a,:c];
@@ -46,7 +46,7 @@
:a
:b
:a
- :c
See also: StackStore
, Store
sourceConcurrentSim.Resource
— TypeAn alias for Container{Int, Int}
, one of the most frequently used types of synchronization primitive.
sourceConcurrentSim.StackStore
— TypeStackStore{N, T<:Number}
A store in which items are stored in a FILO order.
julia> sim = Simulation()
+ :c
See also: StackStore
, Store
sourceConcurrentSim.Resource
— TypeAn alias for Container{Int, Int}
, one of the most frequently used types of synchronization primitive.
sourceConcurrentSim.StackStore
— TypeStackStore{N, T<:Number}
A store in which items are stored in a FILO order.
julia> sim = Simulation()
store = Store{Symbol}(sim)
stack = StackStore{Symbol}(sim)
items = [:a,:b,:a,:c];
@@ -67,7 +67,7 @@
:c
:a
:b
- :a
See also: QueueStore
, Store
sourceConcurrentSim.Store
— TypeStore{N, T<:Number}(env::Environment; capacity::UInt=typemax(UInt))
A store is a resource that can hold a number of items of type N
. It is similar to a Base.Channel
with a finite capacity (put!
blocks after reaching capacity). The put!
and take!
functions are a convenient way to interact with such a "channel" in a way mostly compatible with other discrete event and concurrency frameworks.
See Container
for a more lock-like resource.
Think of Resource
and Container
as locks and of Store
as channels/stacks. They block only if empty (on taking) or full (on storing).
Store
does not guarantee any order of items. See StackStore
and QueueStore
for ordered variants.
julia> sim = Simulation(); store = Store{Int}(sim);
+ :a
See also: QueueStore
, Store
sourceConcurrentSim.Store
— TypeStore{N, T<:Number}(env::Environment; capacity::UInt=typemax(UInt))
A store is a resource that can hold a number of items of type N
. It is similar to a Base.Channel
with a finite capacity (put!
blocks after reaching capacity). The put!
and take!
functions are a convenient way to interact with such a "channel" in a way mostly compatible with other discrete event and concurrency frameworks.
See Container
for a more lock-like resource.
Think of Resource
and Container
as locks and of Store
as channels/stacks. They block only if empty (on taking) or full (on storing).
Store
does not guarantee any order of items. See StackStore
and QueueStore
for ordered variants.
julia> sim = Simulation(); store = Store{Int}(sim);
julia> put!(store, 1); run(sim, 1); put!(store, 2);
@@ -75,4 +75,4 @@
2
julia> value(take!(store))
-1
sourceBase.put!
— Methodput!(sto::Store, item::T)
Put an item into the store. Returns the put event, blocking if the store is full.
sourceBase.lock
— Methodlock(res::Resource)
Locks the Resource and return the lock event. If the capacity of the Container is greater than 1, multiple requests can be made before blocking occurs.
sourceBase.unlock
— Methodunlock(res::Resource)
Unlocks the Resource and return the unlock event.
sourceBase.take!
— Functiontake!(::Store)
An alias for get(::Store)
for easier interoperability with the Base.Channel
interface. Blocks if the store is empty.
sourceSettings
This document was generated with Documenter.jl version 1.8.0 on Saturday 23 November 2024. Using Julia version 1.11.1.
+1
Base.put!
— Methodput!(sto::Store, item::T)
Put an item into the store. Returns the put event, blocking if the store is full.
Base.lock
— Methodlock(res::Resource)
Locks the Resource and return the lock event. If the capacity of the Container is greater than 1, multiple requests can be made before blocking occurs.
Base.unlock
— Methodunlock(res::Resource)
Unlocks the Resource and return the unlock event.
Base.take!
— Functiontake!(::Store)
An alias for get(::Store)
for easier interoperability with the Base.Channel
interface. Blocks if the store is empty.