actors :: MeetingPlace :: defaultinit
actors :: MeetingPlace :: firstcolor
actors :: MeetingPlace :: firstcolor=
actors :: MeetingPlace :: firstid
actors :: MeetingPlace :: firstid=
actors :: MeetingPlace :: meetings_left
actors :: MeetingPlace :: meetings_left=
actors $ MeetingPlace :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
actors :: MeetingPlace :: defaultinit
core :: Object :: defaultinit
actors :: MeetingPlace :: firstcolor
actors :: MeetingPlace :: firstcolor=
actors :: MeetingPlace :: firstid
actors :: MeetingPlace :: firstid=
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.
actors :: MeetingPlace :: meetings_left
actors :: MeetingPlace :: meetings_left=
core :: Object :: output_class_name
Display class name on stdout (debug only).
class MeetingPlace
var meetings_left: Int
var firstcolor: nullable Int
var firstid: Int = 0
var current: Future[Pair] is noinit
private var mutex = new Mutex
fun meet(id, c: Int): nullable Pair do
var new_pair = new Future[Pair]
mutex.lock
if meetings_left == 0 then
mutex.unlock
return null
else
if firstcolor == null then
firstcolor = c
firstid = id
current = new Future[Pair]
else
var color = complements[c][firstcolor.as(not null)]
current.set_value(new Pair(id == firstid, color))
firstcolor = null
meetings_left -= 1
end
new_pair = current
end
mutex.unlock
return new_pair.join
end
end
lib/actors/examples/chameneos-redux/chameneosredux.nit:50,1--80,3