cedric pushed a commit to branch master.

http://git.enlightenment.org/website/www-content.git/commit/?id=c23ca903cd2479043c67fd8094581475b9af296b

commit c23ca903cd2479043c67fd8094581475b9af296b
Author: Clément Bénier <clement.ben...@openwide.fr>
Date:   Mon Sep 7 10:20:55 2015 +0200

    Wiki page main_loop_pg created: 1 main + 5 PG + index + 2 images
    
    Signed-off-by: Clément Bénier <clement.ben...@openwide.fr>
---
 media/mainloop_idlers.png                          | Bin 0 -> 6996 bytes
 media/mainloop_pos_map_all.png                     | Bin 0 -> 35966 bytes
 pages/docs.txt                                     |   1 +
 pages/program_guide/index.txt                      |   1 +
 pages/program_guide/main_loop/animators.txt        | 130 +++++++++++++++++++++
 pages/program_guide/main_loop/file_descriptors.txt |  96 +++++++++++++++
 pages/program_guide/main_loop/idlers.txt           |  70 +++++++++++
 pages/program_guide/main_loop/index.txt            |   5 +
 pages/program_guide/main_loop/threads.txt          | 123 +++++++++++++++++++
 pages/program_guide/main_loop/timers.txt           | 105 +++++++++++++++++
 pages/program_guide/main_loop_pg.txt               |  63 ++++++++++
 11 files changed, 594 insertions(+)

diff --git a/media/mainloop_idlers.png b/media/mainloop_idlers.png
new file mode 100644
index 0000000..9d497a4
Binary files /dev/null and b/media/mainloop_idlers.png differ
diff --git a/media/mainloop_pos_map_all.png b/media/mainloop_pos_map_all.png
new file mode 100644
index 0000000..072def1
Binary files /dev/null and b/media/mainloop_pos_map_all.png differ
diff --git a/pages/docs.txt b/pages/docs.txt
index 238c34e..0ddab7b 100644
--- a/pages/docs.txt
+++ b/pages/docs.txt
@@ -67,6 +67,7 @@ Go check the current available version of EFL on each 
distro/platform:
   * [[program_guide/eina_pg|Eina PG]]
   * [[program_guide/focus_ui_pg|Managing UI Component Focus PG]]
   * [[program_guide/customizing_ui_pg|Customizing UI Components PG]]
+  * [[program_guide/main_loop_pg|Main Loop PG]]
 
 === Samples ===
 
diff --git a/pages/program_guide/index.txt b/pages/program_guide/index.txt
index d53fab2..f563afc 100644
--- a/pages/program_guide/index.txt
+++ b/pages/program_guide/index.txt
@@ -10,4 +10,5 @@
   * [[program_guide/eina_pg|Eina PG]]
   * [[program_guide/customizing_ui_pg|Customizing UI Components PG]]
   * [[program_guide/focus_ui_pg|Managing UI Component Focus PG]]
+  * [[program_guide/main_loop_pg|Main Loop PG]]
 ++++
diff --git a/pages/program_guide/main_loop/animators.txt 
b/pages/program_guide/main_loop/animators.txt
new file mode 100644
index 0000000..6061b0d
--- /dev/null
+++ b/pages/program_guide/main_loop/animators.txt
@@ -0,0 +1,130 @@
+{{page>index}}
+---------
+===== Animators =====
+
+Animators are a specific type of timer, specially designed for on-screen
+animation purposes:
+
+   * The time interval is usually known when they are created.
+   * They are called at each screen refresh and their interval can vary. The 
interval can depend on the system load, the target power consumption, and other 
factors. The exact interval is not relevant.
+
+To implement animators, Ecore provides the Ecore animator subsystem.
+
+=== Table of Contents ===
+
+  * [[#Forever-running_Animator|Forever-running Animator]]
+  * [[#Specific-duration_Animator|Specific-duration Animator]]
+  * [[#To_create_and_destroy_the_animator|To create and destroy the animator]]
+    * [[#To_create_the_animator|To create the animator]]
+    * [[#To_destroy_the_animator|To destroy the animator]]
+  * [[#To_manage_the_animator|To manage the animator]]
+    * [[#To_pause_the_currently_running_animator|To pause the currently 
running animator]]
+    * [[#To_query_Ecore_for_the_interval_between_2_animator_calls|To query 
Ecore for the interval between 2 animator calls]]
+    * [[#To_change_the_interval|To change the interval]]
+
+=== Related Info ===
+
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__Animator__Group.html|Ecore
 Animator functions API]]
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/tutorial_ecore_animator.html|Ecore
 Animator Example]]
+
+==== Forever-running Animator ====
+
+To create an animation that runs for an indefinite time:
+
+<code c>
+Eina_Bool my_anim_cb(void *data)
+{
+   static int count = 0;
+   count++;
+   if (count &lt; 5)
+      return ECORE_CALLBACK_RENEW;
+
+   return ECORE_CALLBACK_CANCEL;
+}
+ecore_animator_add(my_anim_cb, my_data);
+</code>
+
+This example looks the same as the one using an Ecore timer. The
+''ecore_animator_add()'' function takes the callback function and data to pass
+to it, and returns an ''Ecore_Animator'' object. The function is called at a
+system-defined interval until it returns ''ECORE_CALLBACK_CANCEL'' instead of
+''ECORE_CALLBACK_RENEW''.
+
+==== Specific-duration Animator ====
+
+An animator callback for an animator running a specific time has a different
+prototype than the forever running animator.
+
+This callback function receives both data and a position which represents the
+current time among the full timeline, 0 meaning the beginning of the
+animation, and 1 meaning the end of the animation, returning
+''ECORE_CALLBACK_CANCEL'' to abort, or ''ECORE_CALLBACK_RENEW'' to continue.
+
+==== To create and destroy the animator ====
+
+== To create the animator ==
+
+Use the ''ecore_animator_timeline_add()'' function. The first parameter
+specifies the animator duration, the second parameter is the callback
+function, and the third parameter is the data to pass to the callback. The
+data parameter is optional.
+
+<code c>
+Eina_Bool my_anim_cb(void *data, double position)
+{
+   if (position < .5)
+      return ECORE_CALLBACK_RENEW;
+
+   return ECORE_CALLBACK_CANCEL;
+}
+ecore_animator_timeline_add(5., my_anim_cb, my_data);
+</code>
+
+In this example, the animator is specified to run for five seconds. The
+function returns ''ECORE_CALLBACK_CANCEL'' as soon as the position among the
+timeline passes half of the duration, 2.5 seconds.
+
+Ecore can generate a virtual position from the original one using
+''ecore_animator_pos_map(position, map, v1, v2)''. Several maps are available:
+
+    * ''ECORE_POS_MAP_LINEAR'': linear from 0.0 to 1.0.
+    * ''ECORE_POS_MAP_ACCELERATE'': start slow, then speed up.
+    * ''ECORE_POS_MAP_DECELERATE'': start fast, then slow down.
+    * ''ECORE_POS_MAP_SINUSOIDAL'': start slow, speed up, then slow down at 
the end.
+    * ''ECORE_POS_MAP_ACCELERATE_FACTOR'': start slow, then speed up, v1 being 
a power factor: 0.0 is linear, 1.0 is standard acceleration, 2.0 is a much more 
pronounced acceleration (squared), and 3.0 is cubed.
+    * ''ECORE_POS_MAP_DECELERATE_FACTOR'': start fast, then slow down, v1 
being a power factor: 0.0 is linear, 1.0 is standard deceleration, 2.0 is a 
much more pronounced deceleration (squared), and 3.0 is cubed.
+    * ''ECORE_POS_MAP_SINUSOIDAL_FACTOR'': start slow, speed up, then slow 
down at the end, v1 being a power factor: 0.0 is linear, 1.0 is a standard 
sinusoidal, 2.0 is a much more pronounced sinusoidal (squared), and 3.0 is 
cubed.
+    * ''ECORE_POS_MAP_DIVISOR_INTERP'': start at gradient * v1, interpolated 
with the power of v2 curve.
+    * ''ECORE_POS_MAP_BOUNCE'': start at 0.0, then drop like a ball bouncing 
to the ground at 1.0, and bounce v2 times, with a decay factor of v1.
+    * ''ECORE_POS_MAP_SPRING'': start at 0.0, then wobble like a spring to the 
rest position 1.0, and wobble v2 times, with a decay factor of v1.
+
+{{ :mainloop_pos_map_all.png }}
+
+== To destroy the animator ==
+
+Use the ''ecore_animator_del()'' function. The animator to destroy must be
+running, that is, it has not returned a ''false'' value. If the animator is
+not running, the function cannot be called.
+
+
+==== To manage the animator ====
+
+== To pause the currently running animator ==
+
+Use the ''ecore_animator_freeze()'' function. Note that time continues ticking
+even if the animator is frozen, and that resuming the animation using the
+''ecore_animator_thaw()'' function does not actually resume, if the full
+runtime has been passed in the meanwhile.
+
+== To query Ecore for the interval between 2 animator calls ==
+
+Use the ''ecore_animator_frametime_get()'' function.
+
+== To change the interval ==
+
+Use the ''ecore_animator_frametime_set(interval)'' function. Note that too
+small a value causes performance and power consumption issues, and too high a
+value makes the animation jerky.
+
+------
+{{page>index}}
diff --git a/pages/program_guide/main_loop/file_descriptors.txt 
b/pages/program_guide/main_loop/file_descriptors.txt
new file mode 100644
index 0000000..1f84af1
--- /dev/null
+++ b/pages/program_guide/main_loop/file_descriptors.txt
@@ -0,0 +1,96 @@
+{{page>index}}
+---------
+===== File Descriptors =====
+
+Ecore provides an infrastructure to monitor file descriptors, so that files do
+not have to be blocked or polled to read or write on them. Instead, monitor
+sockets, pipes, or other streams are used to get a file descriptor.
+
+=== Table of Contents ===
+
+  * [[#To_manage_the_file_descriptors|To manage the file descriptors]]
+    * [[#To_set_a_callback|To set a callback]]
+    * [[#To_listen_to_events|To listen to events]]
+    * [[#To_wait_for_incoming_data_on_the_file_descriptor|To wait for incoming 
data on the file descriptor]]
+    * [[#To_delete_a_file_descriptor_handler|To delete a file descriptor 
handler]]
+    * [[#To_get_the_handler's_file_descriptor|To get the handler's file 
descriptor]]
+    * [[#To_select_whether_a_flag_is_active_on_a_handler|To select whether a 
flag is active on a handler]]
+    * [[#To_change_the_flags_the_handler_is_monitoring|To change the flags the 
handler is monitoring]]
+
+=== Related Info ===
+
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__FD__Handler__Group.html|File
 Descriptor Handling Functions API]]
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/ecore_fd_handler_example_c.html|File
 Descriptors Example]]
+
+==== To manage the file descriptors ====
+
+== To set a callback ==
+
+Use the ''_my_cb_func()'' function. Its first parameter is the data passed to
+it (optional), and the second one is the Ecore file descriptor handler. Its
+return value is, as in most Ecore callbacks, ''ECORE_CALLBACK_RENEW'' or
+''ECORE_CALLBACK_CANCEL''. It tells Ecore whether it wants to be called again
+or whether its treatment is finished.
+
+== To listen to events ==
+
+Use the ''ecore_main_fd_handler_add()'' function.
+
+== To wait for incoming data on the file descriptor ==
+
+To wait for incoming data (that is, to read data) on the ''my_fd'' file
+descriptor, passing ''my_data'':
+
+<code c>
+Eina_Bool my_fd_cb(void *data, Ecore_Fd_Handler *handler)
+{
+   int fd;
+   fd = ecore_main_fd_handler_fd_get(handler);
+   count = read(fd, buf, sizeof(buf)); // This is guaranteed not to block
+
+   return ECORE_CALLBACK_RENEW;
+}
+ecore_main_fd_handler_add(my_fd, ECORE_FD_READ, my_fd_cb, my_data, NULL, NULL);
+</code>
+
+== To delete a file descriptor handler ==
+
+Use the ''ecore_main_fd_handler_del()'' function. This does not close the file
+descriptor. Always delete the handlers before closing the actual file
+descriptors.
+
+== To get the handler's file descriptor ==
+
+Use the ''ecore_main_fd_handler_fd_get()'' function.
+
+== To select whether a flag is active on a handler ==
+
+Use the
+''ecore_main_fd_handler_active_get()'' function. For example, the handler is
+set to monitor both ''ECORE_FD_READ'' and ''ECORE_FD_ERROR''. The following
+example finds out whether the function was called because of an error:
+
+<code c>
+Eina_Bool my_fd_cb(void *data, Ecore_Fd_Handler *handler)
+{
+   int fd;
+   fd = ecore_main_fd_handler_fd_get(handler);
+   if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR) == EINA_TRUE)
+     {
+        // We have an error!
+
+        return ECORE_CALLBACK_CANCEL;
+     }
+   count = read(fd, buf, sizeof(buf)); // This is guaranteed not to block
+
+   return ECORE_CALLBACK_RENEW;
+}
+ecore_main_fd_handler_add(my_fd, ECORE_FD_READ | ECORE_FD_ERROR, my_fd_cb, 
my_data, NULL, NULL);
+</code>
+
+== To change the flags the handler is monitoring ==
+
+Use the ''ecore_main_fd_handler_active_set()'' function.
+
+-------
+{{page>index}}
diff --git a/pages/program_guide/main_loop/idlers.txt 
b/pages/program_guide/main_loop/idlers.txt
new file mode 100644
index 0000000..cdebe2b
--- /dev/null
+++ b/pages/program_guide/main_loop/idlers.txt
@@ -0,0 +1,70 @@
+{{page>index}}
+--------------
+===== Idlers =====
+
+When the rendering is done and all work is finished, the main loop enters its 
idle state until the next loop. You can get the functions of your application 
called back before the main loop enters or exits the idle state, or when it is 
in the idle state. They are respectively called ''Ecore_Idle_Enterer'', 
''Ecore_Idle_Exiter'', and ''Ecore_Idler''.
+
+{{ :mainloop_idlers.png }}
+
+The idle enterers, exiters, and idlers all have the same prototype,
+''my_idler()'', which receives data and returns ''ECORE_CALLBACK_RENEW'' or
+''ECORE_CALLBACK_CANCEL'' to tell Ecore whether it wants to be called again or
+is finished.
+
+=== Table of Contents ===
+
+  * [[#To_manage_the_idlers|To manage the idlers]]
+    * [[#To_add_an_idler|To add an idler]]
+    * [[#To_delete_an_idler|To delete an idler]]
+    * [[#To_add_and_delete_idle_exiters|To add and delete idle exiters]]
+    * [[#To_add_and_delete_idle_enterers|To add and delete idle enterers]]
+
+=== Related Info ===
+
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__Idle__Group.html|Ecore
 Idle functions API]]
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/ecore_idler_example_c.html|Ecore
 Idle Example]]
+
+=== To manage the idlers ===
+
+== To add an idler ==
+
+Use the ''ecore_idler_add()'' function.
+
+== To delete an idler ==
+
+Use the ''ecore_idler_del()'' function.
+
+== To add and delete idle exiters ==
+
+Use the ''ecore_idle_exiter_add()'' and ''ecore_idle_exiter_del()'' functions.
+
+== To add and delete idle enterers ==
+
+Use the ''ecore_idle_enterer_add()'' and ''ecore_idle_enterer_del()''
+functions. The ''ecore_idle_enterer_before_add()'' function is also available,
+if you want your function to be added at the top of the list so that it is
+called before the others.
+
+<code c>
+Eina_Bool my_idle_enterer_cb(void *data)
+{
+   return ECORE_CALLBACK_RENEW;
+}
+
+Eina_Bool my_idle_exiter_cb(void *data)
+{
+   return ECORE_CALLBACK_CANCEL;
+}
+
+Eina_Bool my_idler(void *data)
+{
+   return ECORE_CALLBACK_RENEW;
+}
+
+ecore_idle_enterer_add(my_idle_enterer_cb, my_data);
+ecore_idle_exiter_add(my_idle_exiter_cb, my_data);
+ecore_idler_add(my_idler_cb, my_data);
+</code>
+
+-------
+{{page>index}}
diff --git a/pages/program_guide/main_loop/index.txt 
b/pages/program_guide/main_loop/index.txt
new file mode 100644
index 0000000..f2f14f9
--- /dev/null
+++ b/pages/program_guide/main_loop/index.txt
@@ -0,0 +1,5 @@
+++++Main Loop Menu|
+^   [[/program_guide/main_loop_pg|Main Loop Guide]]  ^^^^^
+|       [[/program_guide/main_loop/timers|Timers]]    |   
[[/program_guide/main_loop/animators|Animators]]    |   
[[/program_guide/main_loop/file_descriptors|File Descriptors]]    |   
[[/program_guide/main_loop/threads|Threads]]    |   
[[/program_guide/main_loop/idlers|Idlers]]     |
+++++
+
diff --git a/pages/program_guide/main_loop/threads.txt 
b/pages/program_guide/main_loop/threads.txt
new file mode 100644
index 0000000..879b76f
--- /dev/null
+++ b/pages/program_guide/main_loop/threads.txt
@@ -0,0 +1,123 @@
+{{page>index}}
+---------
+===== Threads ====
+
+EFL is not entirely thread-safe. This means that if a task is running in
+another thread and, for example, an Evas object shows the status progress of
+this task, the object cannot be updated from within the thread. Updating can
+only be done from the main thread that runs the main loop.
+
+Ecore provides a facility to perform tasks on separate worker threads. It is
+not a simple wrapper around standard threads provided by the operating system.
+With Ecore threads, it is easier to dispatch a worker function to perform some
+heavy tasks and get the result once it completes. It does not block the
+application UI. It is also easy to cancel and reschedule threads. Several
+threads can be launched simultaneously, since Ecore schedules them according
+to the number of processors the system has and the maximum amount of
+concurrent threads set for the application.
+
+Ecore has 2 kinds of threads:
+
+   * Short jobs do not give any kind of information on their status to the 
parent. They are best used for short computing-intensive snippets of code.
+   * Feedback jobs give information on their status to the parent. They are 
best used for longer snippets requiring a feedback loop, such as an ongoing 
file download.
+
+=== Table of Contents ===
+
+  * [[#To_manage_threads|To manage threads]]
+    * [[#To_cancel_a_thread|To cancel a thread]]
+    * [[#To_execute_a_thread_later|To execute a thread later]]
+    * [[#To_get_the_maximum_number_of_concurrent_threads|To get the maximum 
number of concurrent threads]]
+    * [[#To_query_the_number_of_active_threads|To query the number of active 
threads]]
+
+=== Related Info ===
+
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__Thread__Group.html|Ecore
 Thread functions API]]
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/ecore_thread_example_c.html|Ecore
 Thread Example]]
+
+Ecore creates a pool of worker threads. The exact count is computed from the
+number of CPUs or cores, or it can be specified by the application itself.
+
+When a worker thread is idle, it picks a job to execute from the waiting list
+until there is none left. In the following example, there are 2 threads
+defined by ''my_short_job()'' and ''my_feedback_job()''. Both threads take 2
+parameters: some data passed to them, and the actual thread running. Call a
+callback when the jobs end, whether they are cancelled (''my_job_cancel()'')
+or end normally (''my_job_end()'').
+
+<code c>
+struct feedback_msg
+{
+   int pos;
+};
+
+void my_short_job(void *data, Ecore_Thread *thread)
+{
+   usleep(200000);
+}
+
+void my_feedback_job(void *data, Ecore_Thread *thread)
+{
+   int i;
+   for (i = 0; i &lt; 100; i++)
+     {
+        usleep(50000); // You can have some real computation done
+        struct feedback_msg *message = malloc(sizeof(struct feedback_msg));
+        if (message)
+          {
+             message->pos = i;
+             ecore_thread_feedback(thread, message);
+          }
+        if (ecore_thread_check(thread))
+           return;
+     }
+}
+
+void my_feedback_job_notify(void *data, Ecore_Thread *thread, void *msg)
+{
+   struct feedback_msg *message = msg;
+   free(message);
+}
+
+void my_job_end(void *data, Ecore_Thread *thread)
+{
+   printf("Thread has normally ended.\n");
+}
+
+void my_job_cancel(void *data, Ecore_Thread *thread)
+{
+   printf("Thread has been cancelled.\n");
+}
+
+ecore_thread_run(my_short_job, my_job_end, my_job_cancel, my_data);
+ecore_thread_feedback_run(my_feedback_job, my_feedback_job_notify, my_job_end, 
my_job_cancel, my_data, EINA_FALSE);
+</code>
+
+==== To manage threads ====
+
+== To cancel a thread ==
+
+Use the ''ecore_thread_cancel()'' function. However, note that this is done
+cooperatively: the thread continues to run until it exists. Call the
+''ecore_thread_check()'' function regularly to check whether the thread has
+been marked for cancellation and exit if ''true''.
+
+== To execute a thread later ==
+
+Use the ''ecore_thread_reschedule()'' function. This function is added to the
+end of the pending tasks.
+
+== To get the maximum number of concurrent threads ==
+
+Use the ''ecore_thread_max_get()'' function. If needed, set it by using the
+''ecore_thread_max_set()'' function, or reset the default value using the
+''ecore_thread_max_reset()'' function.
+
+== To query the number of active threads ==
+
+Use the ''ecore_thread_active_get()'' function. To query the number of
+available worker threads, use the ''ecore_thread_available_get()'' function,
+which is basically the same as the ''ecore_thread_max_get()'' -
+''ecore_thread_active_get()''.
+
+---------
+{{page>index}}
diff --git a/pages/program_guide/main_loop/timers.txt 
b/pages/program_guide/main_loop/timers.txt
new file mode 100644
index 0000000..1662033
--- /dev/null
+++ b/pages/program_guide/main_loop/timers.txt
@@ -0,0 +1,105 @@
+{{page>index}}
+---------
+===== Timers =====
+
+Ecore provides timers, which schedule events that are executed later at a
+specific time. The event can occur once or several times at specific
+intervals.
+
+=== Table of Contents ===
+
+  * [[#To_create_and_destroy_a_timer|To create and destroy a timer]]
+    * [[#To_create_a_timer|To create a timer]]
+    * [[#To_delete_the_timer|To delete the timer]]
+  * [[#To_manage_a_timer|To manage a timer]]
+    * [[#To_change_the_timer's_interval|To change the timer's interval]]
+    * [[#To_get_the_timer's_pending_time|To get the timer's pending time]]
+    * [[#To_delay_the_timer's_next_occurrence|To delay the timer's next 
occurrence]]
+    * [[#To_pause_the_currently_running_timer|To pause the currently running 
timer]]
+    * 
[[#To_query_the_current_value_of_the_defined_timer_infrastructure_precision|To 
query the current value of the defined timer infrastructure precision]]
+
+=== Related Info ===
+
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__Timer__Group.html|Ecore
 Timer functions API]]
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/ecore_timer_example_c.html|Ecore
 Timers Example]]
+
+A timer callback prototype looks like the ''my_timed_cb()'' callback function.
+This function receives data from the application, and returns a Boolean value
+to specify whether it is called again or completed. The following macros are
+also provided:
+
+   * ''ECORE_CALLBACK_RENEW'': the function is called again after the timeout.
+   * ''ECORE_CALLBACK_CANCEL'': the function is not called again, Ecore 
destroys automatically everything associated with the timer.
+
+==== To create and destroy a timer ====
+
+== To create a timer ==
+
+Use the ''ecore_timer_add()'' function. The interval, specified
+in seconds, indicates when the given function is called, and receives the
+specified data as a parameter. It returns an ''Ecore_Timer'' object.
+
+In the following example, the ''my_timed_cb()'' function is run after 2
+seconds and it receives ''my_data''. It is renewed while its count variable
+value is under 5, and stops after that.
+
+<code c>
+Eina_Bool my_timed_cb(void *data)
+{
+   static int count = 0;
+   count++;
+
+   if (count < 5)
+      return ECORE_CALLBACK_RENEW;
+
+   return ECORE_CALLBACK_CANCEL;
+}
+ecore_timer_add(2.0, my_timed_cb, my_data);
+</code>
+
+== To delete the timer ==
+
+Use the ''ecore_timer_del()'' function. The timer to delete must still be
+running, that is, it has not returned a ''false'' value. If the timer is not
+running, the function cannot be called.
+
+=== To manage a timer ===
+
+== To change the timer's interval ==
+
+Use the ''ecore_timer_interval_set()'' function. The interval is specified in
+seconds. If set during a timer call, this affects the next interval. Use the
+''ecore_timer_interval_get()'' function to get the timer's current interval.
+
+== To get the timer's pending time ==
+
+Use the ''ecore_timer_pending_get()'' function.
+
+== To delay the timer's next occurrence ==
+
+Use the ''ecore_timer_delay()'' function. The function adds the specified time
+to the current interval. It does not change the future occurrences' interval.
+You can also reset the current interval to its full value by using the
+''ecore_timer_reset()'' function.
+
+== To pause the currently running timer ==
+
+Use the ''ecore_timer_freeze()'' function. The remaining time is saved and
+used again when the timer is resumed with the ''ecore_timer_thaw()'' function.
+
+== To query the current value of the defined timer infrastructure precision ==
+
+Use the ''ecore_timer_precision_get()'' function. A higher delay means that
+more timers can be run together. It diminishes the need to use system wake-ups
+and thus lowers the power consumption.
+
+To set the precision, use the ''ecore_timer_precision_set()'' function. This 
sets
+the precision for all timers. For example, there are 2 timers, one that
+expires in 2.0 seconds and another that expires in 2.1 seconds. If the
+precision is set to 0.1 seconds, Ecore requests the next expiration to happen
+in 2.1 seconds and runs both callbacks at once, instead of one at 2.0 seconds
+and the other one 0.1 seconds later. However, if there is no timer expiring in
+2.1 seconds, the timeout is at the minimum interval, 2 seconds.
+
+--------
+{{page>index}}
diff --git a/pages/program_guide/main_loop_pg.txt 
b/pages/program_guide/main_loop_pg.txt
new file mode 100644
index 0000000..e09b876
--- /dev/null
+++ b/pages/program_guide/main_loop_pg.txt
@@ -0,0 +1,63 @@
+{{page>index}}
+-------
+===== Main Loop =====
+
+The EFL is event-driven. This means that the application polls for data, and
+listens for events to interact with it.
+
+The Ecore library provides the main loop abstraction. It gets data when data
+is available and sends the events so that costly polling threads are not
+needed. Ecore manages polling, timers, events, and file descriptors. When
+there is no ongoing event, the main loop automatically enters an idle mode,
+minimizing the power consumption. The loop wakes up when needed.
+
+=== Table of Contents ===
+
+  * [[/program_guide/main_loop/timers|Timers]]
+    * [[/program_guide/main_loop/timers#To_create_and_destroy_a_timer|To 
create and destroy a timer]]
+      * [[/program_guide/main_loop/timers#To_create_a_timer|To create a timer]]
+      * [[/program_guide/main_loop/timers#To_delete_the_timer|To delete the 
timer]]
+    * [[/program_guide/main_loop/timers#To_manage_a_timer|To manage a timer]]
+      * [[/program_guide/main_loop/timers#To_change_the_timer's_interval|To 
change the timer's interval]]
+      * [[/program_guide/main_loop/timers#To_get_the_timer's_pending_time|To 
get the timer's pending time]]
+      * 
[[/program_guide/main_loop/timers#To_delay_the_timer's_next_occurrence|To delay 
the timer's next occurrence]]
+      * 
[[/program_guide/main_loop/timers#To_pause_the_currently_running_timer|To pause 
the currently running timer]]
+      * 
[[/program_guide/main_loop/timers#To_query_the_current_value_of_the_defined_timer_infrastructure_precision|To
 query the current value of the defined timer infrastructure precision]]
+  * [[/program_guide/main_loop/animators|Animators]]
+    * 
[[/program_guide/main_loop/animators#Forever-running_Animator|Forever-running 
Animator]]
+    * 
[[/program_guide/main_loop/animators#Specific-duration_Animator|Specific-duration
 Animator]]
+    * 
[[/program_guide/main_loop/animators#To_create_and_destroy_the_animator|To 
create and destroy the animator]]
+      * [[/program_guide/main_loop/animators#To_create_the_animator|To create 
the animator]]
+      * [[/program_guide/main_loop/animators#To_destroy_the_animator|To 
destroy the animator]]
+    * [[/program_guide/main_loop/animators#To_manage_the_animator|To manage 
the animator]]
+      * 
[[/program_guide/main_loop/animators#To_pause_the_currently_running_animator|To 
pause the currently running animator]]
+      * 
[[/program_guide/main_loop/animators#To_query_Ecore_for_the_interval_between_2_animator_calls|To
 query Ecore for the interval between 2 animator calls]]
+      * [[/program_guide/main_loop/animators#To_change_the_interval|To change 
the interval]]
+  * [[/program_guide/main_loop/file_descriptors|File Descriptors]]
+    * 
[[/program_guide/main_loop/file_descriptors#To_manage_the_file_descriptors|To 
manage the file descriptors]]
+      * [[/program_guide/main_loop/file_descriptors#To_set_a_callback|To set a 
callback]]
+      * [[/program_guide/main_loop/file_descriptors#To_listen_to_events|To 
listen to events]]
+      * 
[[/program_guide/main_loop/file_descriptors#To_wait_for_incoming_data_on_the_file_descriptor|To
 wait for incoming data on the file descriptor]]
+      * 
[[/program_guide/main_loop/file_descriptors#To_delete_a_file_descriptor_handler|To
 delete a file descriptor handler]]
+      * 
[[/program_guide/main_loop/file_descriptors#To_get_the_handler's_file_descriptor|To
 get the handler's file descriptor]]
+      * 
[[/program_guide/main_loop/file_descriptors#To_select_whether_a_flag_is_active_on_a_handler|To
 select whether a flag is active on a handler]]
+      * 
[[/program_guide/main_loop/file_descriptors#To_change_the_flags_the_handler_is_monitoring|To
 change the flags the handler is monitoring]]
+  * [[/program_guide/main_loop/threads|Threads]]
+    * [[/program_guide/main_loop/threads#To_manage_threads|To manage threads]]
+      * [[/program_guide/main_loop/threads#To_cancel_a_thread|To cancel a 
thread]]
+      * [[/program_guide/main_loop/threads#To_execute_a_thread_later|To 
execute a thread later]]
+      * 
[[/program_guide/main_loop/threads#To_get_the_maximum_number_of_concurrent_threads|To
 get the maximum number of concurrent threads]]
+      * 
[[/program_guide/main_loop/threads#To_query_the_number_of_active_threads|To 
query the number of active threads]]
+  * [[/program_guide/main_loop/idlers|Idlers]]
+    * [[/program_guide/main_loop/idlers#To_manage_the_idlers|To manage the 
idlers]]
+      * [[/program_guide/main_loop/idlers#To_add_an_idler|To add an idler]]
+      * [[/program_guide/main_loop/idlers#To_delete_an_idler|To delete an 
idler]]
+      * [[/program_guide/main_loop/idlers#To_add_and_delete_idle_exiters|To 
add and delete idle exiters]]
+      * [[/program_guide/main_loop/idlers#To_add_and_delete_idle_enterers|To 
add and delete idle enterers]]
+
+=== Related Info ===
+
+  * 
[[https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__Main__Loop__Group.html|Ecore
 Main Loop API]]
+
+-----
+{{page>index}}

-- 


Reply via email to