2016-04-21 15:11:32 -07:00
|
|
|
class Efl.Loop (Eo.Base)
|
2014-06-16 06:24:45 -07:00
|
|
|
{
|
2016-04-21 15:11:32 -07:00
|
|
|
[[The Efl Main Loop
|
2016-04-15 06:45:15 -07:00
|
|
|
|
2016-04-21 15:11:32 -07:00
|
|
|
Efl main loop provide a clean and tiny event loop library with many modules to
|
|
|
|
do lots of convenient things for a programmer, to save time and effort. It's
|
|
|
|
small and lean, designed to work from embedded systems all the way up to large
|
|
|
|
and powerful multi-cpu workstations. The main loop has a number of primitives to
|
2016-04-15 06:45:15 -07:00
|
|
|
be used with its main loop. It serializes all the primitives and allows for
|
2016-04-21 15:11:32 -07:00
|
|
|
great responsiveness without the need for threads (or any other concurrency), but
|
|
|
|
provide them if you need to.
|
2016-04-15 06:45:15 -07:00
|
|
|
]]
|
2015-05-07 08:36:45 -07:00
|
|
|
methods {
|
2014-06-16 06:24:45 -07:00
|
|
|
iterate {
|
2016-04-15 06:45:15 -07:00
|
|
|
[[Runs a single iteration of the main loop to process everything on the
|
|
|
|
queue.]]
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|
|
|
|
iterate_may_block {
|
2016-04-15 06:45:15 -07:00
|
|
|
[[Runs a single iteration of the main loop to process everything on the
|
|
|
|
queue with block/non-blocking status.]]
|
2014-08-08 07:40:19 -07:00
|
|
|
return: int;
|
2014-06-16 06:24:45 -07:00
|
|
|
params {
|
2016-04-15 06:45:15 -07:00
|
|
|
may_block: int; [[A flag if the main loop has a possibility of blocking.]]
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
begin {
|
2016-04-15 06:45:15 -07:00
|
|
|
[[Runs the application main loop.]]
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|
|
|
|
quit {
|
2016-04-15 06:45:15 -07:00
|
|
|
[[Quits the main loop once all the events currently on the queue have
|
|
|
|
been processed.]]
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|
2016-04-26 12:56:53 -07:00
|
|
|
job {
|
|
|
|
[[Will execute that promise in the near future.]]
|
|
|
|
params {
|
2016-06-02 04:54:59 -07:00
|
|
|
@in data: const(void_ptr) @optional; [[The data to be given when the promise is done.]]
|
2016-05-04 14:44:56 -07:00
|
|
|
}
|
2016-06-02 04:54:59 -07:00
|
|
|
return: promise<void_ptr>; [[The promise that will be triggered.]]
|
2016-05-04 14:44:56 -07:00
|
|
|
}
|
|
|
|
timeout {
|
|
|
|
[[Will trigger this promise when the specified timeout occur.]]
|
|
|
|
params {
|
|
|
|
@in time: double; [[The time from now in second that the main loop will wait before triggering it.]]
|
2016-06-02 04:54:59 -07:00
|
|
|
@in data: const(void_ptr) @optional; [[The data to be given when the promise is done.]]
|
2016-04-26 12:56:53 -07:00
|
|
|
}
|
2016-06-02 04:54:59 -07:00
|
|
|
return: promise<void_ptr>; [[The promise that will be triggered.]]
|
2016-05-30 03:47:21 -07:00
|
|
|
}
|
|
|
|
args_add {
|
|
|
|
[[Add a new set of arguments to the loop that makes an args event.]]
|
|
|
|
params {
|
|
|
|
argc: int; [[The number of strings in the argv array.]]
|
2016-05-31 08:02:26 -07:00
|
|
|
argv: string*; [[The array of argument strings.]]
|
2016-05-30 03:47:21 -07:00
|
|
|
}
|
2016-04-26 12:56:53 -07:00
|
|
|
}
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|
2014-07-31 22:38:40 -07:00
|
|
|
events {
|
2016-04-20 15:54:18 -07:00
|
|
|
idle,enter @restart; [[Event occurs once the main loop enters the idle state.]]
|
|
|
|
idle,exit @restart; [[Event occurs once the main loop exits the idle state.]]
|
2016-04-21 11:57:14 -07:00
|
|
|
idle @restart; [[Event occurs once the main loop is idler. Be carefull, this will spin your CPU high if you keep listening on this event.]]
|
2016-05-30 03:47:21 -07:00
|
|
|
args: Efl.Loop.Args; [[Event happens when args are provided to the loop by args_add().]]
|
2014-07-31 22:38:40 -07:00
|
|
|
/* TODO: All of the legacy ecore events. (Ecore.h header) */
|
|
|
|
}
|
2016-04-21 11:57:14 -07:00
|
|
|
implements {
|
|
|
|
Eo.Base.constructor;
|
2016-05-04 01:08:00 -07:00
|
|
|
Eo.Base.provider_find;
|
2016-04-21 11:57:14 -07:00
|
|
|
}
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|