Event
Object Hierarchy:
Description:
public class Event<
T> :
Object
An event
An event is a bit like a signal where all handlers are dispatched immediately. In other words, as soon as the event is triggered, all
background tasks will be passed to the pool, all idle callback tasks will be added to
the idle queue, and all blocking tasks will be woken.
An interesting side-effect of this is that Event.SourceFunc callbacks can be
executed after they return false, since other events may have caused the callback to be queued again. If you want to make sure that a
callback is not invoked again you should use the cancellable.
Namespace: Bump
Package: bump-0.1
Content:
Properties:
- public TaskQueue pool { construct set; get; }
The pool used to execute background tasks
- public
bool
auto_reset { construct set; get; }
Whether to automatically reset the event after dispatching the
handlers
- public
bool
triggered { set; get; }
Whether or not the event is currently triggered
Delegates:
Creation methods:
- public Event (
bool
auto_reset = true)
Create a new Event
Methods:
- public void reset ()
- public void trigger (T value) throws
Error
Trigger the event
- public void add (owned SourceFunc<T> func,
int
priority = DEFAULT
, Cancellable
? cancellable = null) throws Error
Add a callback to be executed in the idle queue
- public R execute<R> (Callback<T,R> func,
int
priority = DEFAULT
, Cancellable
? cancellable = null) throws Error
Execute the callback and wait for the result
- public async R execute_async<R> (Callback<T,R> func,
int
priority = DEFAULT
, Cancellable
? cancellable = null) throws Error
Execute the callback asynchronously
- public async R execute_background<R> (Callback<T,R> func,
int
priority = DEFAULT
, Cancellable
? cancellable = null) throws Error
Execute the callback asynchronously