core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionpthreads :: ConcurrentCollection :: REAL
Type of the equivalent non thread-safe collectionserialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Collection :: combinations
Allr
-length combinations on self (in same order) without repeated elements.
core :: Collection :: combinations_with_replacement
Allr
-length combination on self (in same order) with repeated elements.
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
core :: Collection :: defaultinit
core :: List :: defaultinit
core :: Sequence :: defaultinit
pthreads :: BlockingQueue :: defaultinit
core :: SequenceRead :: defaultinit
core :: SimpleCollection :: defaultinit
core :: Object :: defaultinit
actors :: Mailbox :: defaultinit
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
core :: SequenceRead :: get_or_default
Try to get an element, returndefault
if the index
is invalid.
core :: SequenceRead :: get_or_null
Try to get an element, returnnull
if the index
is invalid.
core :: Collection :: has_all
Does the collection contain at least each element ofother
?
core :: Collection :: has_any
Does the collection contain at least one element ofother
?
core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother
?
core :: SequenceRead :: index_of_from
The index of the first occurrence ofitem
, starting from pos.
core :: Sequence :: insert_all
Insert all elements at a given position, following elements are shifted.core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: SequenceRead :: iterator_from
Gets a new Iterator starting at positionpos
core :: SequenceRead :: last_index_of
The index of the last occurrence ofitem
.
core :: SequenceRead :: last_index_of_from
The index of the last occurrence ofitem
starting from pos
and decrementing.
core :: SequenceRead :: modulo_index
Returns the real index for a modulo index.serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraypthreads :: ConcurrentCollection :: mutex=
Mutex
used to synchronize access to self
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Collection :: permutations
Allr
-length permutations on self (all possible ordering) without repeated elements.
core :: Collection :: product
Cartesian product, overr
times self
.
pthreads :: ConcurrentCollection :: real_collection
Collection wrapped byself
pthreads :: ConcurrentCollection :: real_collection=
Collection wrapped byself
core :: RemovableCollection :: remove
Remove an occurrence ofitem
core :: RemovableCollection :: remove_all
Remove all occurrences ofitem
core :: SequenceRead :: reverse_iterator
Gets an iterator starting at the end and going backwardscore :: SequenceRead :: reverse_iterator_from
Gets an iterator on the chars of self starting frompos
serialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
core :: Collection :: to_concurrent
Wrapsself
in a thread-safe collection
core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListserialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
core :: Collection :: to_shuffle
Return a new array made of elements in a random order.pthreads :: ConcurrentList :: wrap
pthreads :: ConcurrentCollection
A concurrent variant to the standardCollection
List
pthreads :: ConcurrentSequence
A concurrent variant to the standardSequence
pthreads :: ConcurrentSequenceRead
A concurrent variant to the standardSequenceRead
Serializer::serialize
ConcurrentList
# A Blocking queue implemented from a `ConcurrentList`
# `shift` is blocking if there isn't any element in `self`
# `push` or `unshift` releases every blocking threads
# Corresponds to the mailbox of an actor
class Mailbox[E]
super BlockingQueue[E]
# The associated actor
var actor: Actor is noautoinit
# init self with an associated actor
init with_actor(actor: Actor) do
self.actor = actor
sys.active_actors.increment
end
# Adding the signal to release eventual waiting thread(s)
redef fun push(e) do
mutex.lock
if real_collection.is_empty and not actor.working then
actor.working = true
sys.active_actors.increment
real_collection.push(e)
self.cond.signal
else
real_collection.push(e)
end
mutex.unlock
end
redef fun unshift(e) do
mutex.lock
real_collection.unshift(e)
self.cond.signal
mutex.unlock
end
# If empty, blocks until an item is inserted with `push` or `unshift`
redef fun shift do
mutex.lock
if real_collection.is_empty then
actor.working = false
sys.active_actors.decrement
while real_collection.is_empty do self.cond.wait(mutex)
end
var r = real_collection.shift
mutex.unlock
return r
end
redef fun is_empty do
mutex.lock
var r = real_collection.is_empty
mutex.unlock
return r
end
end
lib/actors/actors.nit:62,1--118,3