AnyEvent::Blackboard - An extension of Async::Blackboard which uses AnyEvent for timeouts.
my $blackboard = AnyEvent::Blackboard->new(); $blackboard->watch([qw( foo bar )], [ $object, "found_foobar" ]); $blackboard->watch(foo => [ $object, "found_foo" ]); # After 250ms, provide ``undef'' for ``foo'' $blackboard->timeout(foo => 0.25);
Async::Blackboard makes a fantastic synchronization component -- however, it does have the possible condition of allowing control to be abandoned due to a lack value. This subclass adds the functionality of timeouts on keys to ensure this doesn't happen.
Default timeout in (optionally fractional) seconds.
A conditional variable to track dispatches. (optional)
When supplied, each dispatch group will be wrapped in calls to ``begin'' and ``end'' on condvar instance.
Set a timer for N seconds to provide "default" value as a value, defaults to `undef`. This can be used to ensure that blackboard workflows do not reach a dead-end if a required value is difficult to obtain.
Overrides Async::Blackboard only for the purpose of adding a timeout.
Wrap calls to ``found'' in condvar transaction counting, if a condvar is supplied. The side-effect is that dispatching is wrapped in conditional variable counting.
Create a clone of this blackboard. This will not dispatch any events, even if the blackboard is prepopulated.
Copyright Â© 2011, Say Media. Distributed under the Artistic License, 2.0.