Collection
pthreads :: ConcurrentCollection :: REAL
Type of the equivalent non thread-safe collectionpthreads :: ConcurrentCollection :: mutex=
Mutex
used to synchronize access to self
pthreads :: ConcurrentCollection :: real_collection
Collection wrapped byself
pthreads :: ConcurrentCollection :: real_collection=
Collection wrapped byself
pthreads $ ConcurrentCollection :: SELF
Type of this instance, automatically specialized in every classpthreads $ ConcurrentCollection :: has_all
Does the collection contain at least each element ofother
?
pthreads $ ConcurrentCollection :: is_empty
Is there no item in the collection?pthreads $ ConcurrentCollection :: rand
Return a random element form the collectionpthreads $ ConcurrentCollection :: to_s
User readable representation ofself
.
core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionpthreads :: ConcurrentCollection :: REAL
Type of the equivalent non thread-safe collectioncore :: 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.
core :: Collection :: defaultinit
core :: Object :: defaultinit
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 :: 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.
pthreads :: 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 :: 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 CURLSListcore :: Collection :: to_shuffle
Return a new array made of elements in a random order.pthreads :: ConcurrentSequenceRead
A concurrent variant to the standardSequenceRead
ConcurrentList
Array
List
pthreads :: ConcurrentSequence
A concurrent variant to the standardSequence
pthreads :: ReverseBlockingQueue
A collection whichis_empty
method blocks until it's empty
# A concurrent variant to the standard `Collection`
abstract class ConcurrentCollection[E]
super Collection[E]
# Type of the equivalent non thread-safe collection
type REAL: Collection[E]
# Collection wrapped by `self`
var real_collection: REAL is noinit
# `Mutex` used to synchronize access to `self`
#
# It is used by the implementation on each protected methods. It can also
# be used externally to ensure that no other `Thread` modify this object.
var mutex = new Mutex
redef fun count(e)
do
mutex.lock
var r = real_collection.count(e)
mutex.unlock
return r
end
redef fun first
do
mutex.lock
var r = real_collection.first
mutex.unlock
return r
end
redef fun has(e)
do
mutex.lock
var r = real_collection.has(e)
mutex.unlock
return r
end
redef fun has_all(e)
do
mutex.lock
var r = real_collection.has_all(e)
mutex.unlock
return r
end
redef fun has_only(e)
do
mutex.lock
var r = real_collection.has_only(e)
mutex.unlock
return r
end
redef fun is_empty
do
mutex.lock
var r = real_collection.is_empty
mutex.unlock
return r
end
redef fun iterator
do
mutex.lock
var r = real_collection.iterator
mutex.unlock
return r
end
redef fun length
do
mutex.lock
var r = real_collection.length
mutex.unlock
return r
end
redef fun to_a
do
mutex.lock
var r = real_collection.to_a
mutex.unlock
return r
end
redef fun rand
do
mutex.lock
var r = real_collection.rand
mutex.unlock
return r
end
redef fun join(sep, last_sep)
do
mutex.lock
var r = real_collection.join(sep, last_sep)
mutex.unlock
return r
end
redef fun to_s
do
mutex.lock
var r = real_collection.to_s
mutex.unlock
return r
end
end
lib/pthreads/concurrent_collections.nit:68,1--179,3