concur
concur
concur -- unit feature to group concurrency related features
Constructors
atomic(T:Any):auto_unwrap T, concur.this.atomic_access is[Private constructor]¶[src]
atomic -- low-level atomic values
Atomic values can be used for communication between threads in a safe
way.
NYI: CLEANUP: REMOVE: replace all uses of concur.atomic by concur.atomic_mutate
Atomic values can be used for communication between threads in a safe
way.
NYI: CLEANUP: REMOVE: replace all uses of concur.atomic by concur.atomic_mutate
atomic_mutate:mutate is¶[src]
atomic_mutate -- a multi-thread variant of mutate using atomic operations
This mutate ensures exclusive access to shared memory via lock-free atomic
operations like compare-and-swap.
In case the type of a mutable field does not permit lock-free atomic accesses,
an internal global lock is used instead to ensure these accesses are
atomic.
Read accesses using `get` are protected from reusing outdated values
by a `read_fence` while Write accesses using `put` include a `write_fence`
after writing the value to ensure the write is not delayed after any
subsequent writes.
This mutate ensures exclusive access to shared memory via lock-free atomic
operations like compare-and-swap.
In case the type of a mutable field does not permit lock-free atomic accesses,
an internal global lock is used instead to ensure these accesses are
atomic.
Read accesses using `get` are protected from reusing outdated values
by a `read_fence` while Write accesses using `put` include a `write_fence`
after writing the value to ensure the write is not delayed after any
subsequent writes.
blocking_mutate:blocking_mutate_using_clock time.Monotonic is¶[src]
blocking_mutate -- a multi-thread variant of mutate using time.Monotonic
This mutate ensures exclusive access to shared memory via using locks and
blocking.
Accidental racy accesses are not permitted by this mutate, i.e., accessing
mutable elements, e.g. via `get` or `put` on a mutable var
`blocking_mutate.this.env.new T`, are not permitted unless we are in code run via
`blocking_mutate.this.env.exclusive`.
This mutate ensures exclusive access to shared memory via using locks and
blocking.
Accidental racy accesses are not permitted by this mutate, i.e., accessing
mutable elements, e.g. via `get` or `put` on a mutable var
`blocking_mutate.this.env.new T`, are not permitted unless we are in code run via
`blocking_mutate.this.env.exclusive`.
blocking_mutate_using_clock(C:time.Clock): is¶[src]
blocking_mutate_using_clock -- a multi-thread variant of mutate using a given Clock
This mutate ensures exclusive access to shared memory via using locks and
blocking.
Accidental racy accesses are not permitted by this mutate, i.e., accessing
mutable elements, e.g, via `get` or `put` on a mutable var
`blocking_mutate_using_clock.this.env.new T`, are not permitted unless we are
in code run via `blocking_mutate.this.env.exclusive`.
For timeouts, this uses the given clock effect.
This mutate ensures exclusive access to shared memory via using locks and
blocking.
Accidental racy accesses are not permitted by this mutate, i.e., accessing
mutable elements, e.g, via `get` or `put` on a mutable var
`blocking_mutate_using_clock.this.env.new T`, are not permitted unless we are
in code run via `blocking_mutate.this.env.exclusive`.
For timeouts, this uses the given clock effect.
Channel(T:Any) ref:Sending_Channel T,Receiving_Channel T is[Contains abstract features]¶[src]
A Channel is a means to send values from one or several threads to one or several
receiver threads. Both, sender and receiver may block if the channel is full or
empty, respectively.
A channel is originally open. It may be closed by a call to `Channel.close` to
close the channel. A closed channel may no longer be used to send data: An attempt
to send data to a closed channel will cause a fault (pre_fault if `safety` is enabled,
otherwise `panic`).
A closed channel may still contain values that have not been received yet. These
values may still be received. Any attempts to receive data from a closed empty
channel will return `nil`.
NYI: UNDER DEVELOPMENT: max buf size
receiver threads. Both, sender and receiver may block if the channel is full or
empty, respectively.
A channel is originally open. It may be closed by a call to `Channel.close` to
close the channel. A closed channel may no longer be used to send data: An attempt
to send data to a closed channel will cause a fault (pre_fault if `safety` is enabled,
otherwise `panic`).
A closed channel may still contain values that have not been received yet. These
values may still be received. Any attempts to receive data from a closed empty
channel will return `nil`.
NYI: UNDER DEVELOPMENT: max buf size
Future(T:Any) ref:Any is[Contains abstract features]¶[src]
A Future is an interface for an asynchronous computation.
Receiving_Channel(T:Any) ref:Any is[Contains abstract features]¶[src]
an interface for a receive-only Channel
scheduling_policy:Any is¶[src]
unit type grouping scheduling policies
Sending_Channel(T:Any) ref:Any is[Contains abstract features]¶[src]
an interface for a send-only Channel
thread_pool:effect is[Private constructor]¶[src]
simple, fixed size thread pool
Threads ref:effect is[Contains abstract features]¶[src]
Threads -- effect that provides concurrent thread
lifecycle: While effect is installed, threads can be spawned.
When the threads effect is uninstated all threads are joined.
lifecycle: While effect is installed, threads can be spawned.
When the threads effect is uninstated all threads are joined.
Unbuffered_Channel(M:mutate,T:Any):Channel T is[Contains abstract features]¶[src]
Unbuffered_Channel -- a Channel without internal storage
This channel always blocks on `infix <-` (`send`) until a corresponding
`prefix <-` (`receive`) is performed by another thread, there is no
buffering performed except for the single value that is currently
being sent from one thread to another.
This channel always blocks on `infix <-` (`send`) until a corresponding
`prefix <-` (`receive`) is performed by another thread, there is no
buffering performed except for the single value that is currently
being sent from one thread to another.
Functions
as_string => String[Inherited from Any]¶[src]
create a String from this instance. Unless redefined, `a.as_string` will
create `"instance[T]"` where `T` is the dynamic type of `a`
create `"instance[T]"` where `T` is the dynamic type of `a`
channel(T:Any) => concur.this.Channel T¶[src]
create a Channel of the given type
channel(T:Any,capacity i64) => concur.this.Channel T¶[src]
create a Channel of the given type and given capacity
dynamic_apply(R:Any,F:Typed_Function R,f F) => R[Inherited from Any]¶[src]
dynamic_apply -- apply `f.call` to `Any.this`'s dynamic type and value
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
dynamic_type => Type[Inherited from Any]¶[src]
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
prefix $ => String[Inherited from Any]¶[src]
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
thread_pool(R:Any,size i64,code Function R) => outcome R¶[src]
simple, fixed size thread pool
use `concur.thread_pool.env.submit` to
submit a task to the thread_pool.
use `concur.thread_pool.env.submit` to
submit a task to the thread_pool.
Type Features
type.as_string => String[Inherited from Type]¶[src]
string representation of this type to be used for debugging.
result has the form "<name>", but this might change in the future
result has the form "<name>", but this might change in the future
type.dynamic_type => Type[Inherited from Type]¶[src]
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
Note: Typechecking is undecidable when 'type' is a type, Mark B. Reinhold, 1989
see: https://dspace.mit.edu/bitstream/handle/1721.1/149366/MIT-LCS-TR-458.pdf?sequence=6
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
Note: Typechecking is undecidable when 'type' is a type, Mark B. Reinhold, 1989
see: https://dspace.mit.edu/bitstream/handle/1721.1/149366/MIT-LCS-TR-458.pdf?sequence=6
type.infix :(T:Any) => bool[Inherited from Type]¶[src]
Is this type assignable to a type parameter with constraint `T`?
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
type.name => String[Inherited from Type]¶[src]
name of this type, including type parameters, e.g. 'option (list i32)'.
type.prefix $ => String[Inherited from Type]¶[src]
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
type.type_value => Type[Inherited from Any]¶[src]
Get a type as a value.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
0.099dev (GIT hash e2d5298d8107bb5fe79600fdb06a49bc75756344)