pthreads :: MyThread :: defaultinit
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
pthreads :: MyThread :: defaultinit
core :: Object :: defaultinit
core :: Finalizable :: defaultinit
pthreads :: Thread :: defaultinit
core :: Finalizable :: finalize
Liberate any resources held byself
before the memory holding self
is freed
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 :: Thread :: main_intern
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).
private class MyThread
super Thread
# This `ConcurrentArray` has its own `Mutex`
var array: ConcurrentArray[String]
# Use an explicit `Barrier`
var barrier: Barrier
var id: Int
redef fun main
do
# Print and add to Array 1000 times
for i in 1000.times do
var str = "thread {id}: {i}"
array.add str
end
# Wait at the `barrier`
barrier.wait
return id
end
end
lib/pthreads/examples/concurrent_array_and_barrier.nit:25,1--49,3