efl/src/lib/eina
Gustavo Sverzut Barbieri d10a35628c eina: add Eina_Coro - coroutine support.
Coroutines are cooperative tasks, in the sense that the caller will
stop until the target function runs. The target function must either
yield control back to the caller (main thread), or exit. There is no
preemption of the two tasks, thus no special care needs to be taken
regarding shared data.

If the target coroutine yields control using eina_coro_yield(), then
it will be paused until it's manually ran again by caller (main
thread), which is executed with eina_coro_run().

Another common usage is to await for another task to be completed,
this can be done by waiting for a future to be resolved. It will
automatically yield and inform the caller of the future so it can
schedule properly instead of keep calling the task. Waiting for many
tasks can be achieved by using eina_future_all() or
eina_future_race(). This is done with eina_coro_await().

Due portability it was implemented using Eina_Thread, Eina_Lock and
Eina_Condition. Regular threads will ensure that the state is fully
preserved (stack, registers) in a platform independent way. Each
thread will wait on its own turn using the Eina_Lock and
Eina_Condition, thus it's guaranteed that only one is being executed
at the same time.

The API is small and should allow different implementations shall we
need them, like manually saving the stack and registers, then
restoring those -- problem is doing that in a portable way,
setjmp()/longjmp() won't save the stack, makecontext()/swapcontext()
doesn't work right on MacOS...

Hooks can be used to be informed when the main routine exits and then
enters, likewise when the coroutine enters and exits. These will be
used, for instance, to automatically get, adopt and return
Efl_Domain_Data needed to make Efl_Object work in such
environment. The flow is simple:

  - main exit (called from main thread)
  - coroutine enter (called from worker thread)
  - coroutine exit (called from worker thread)
  - main enter (called from main thead)

Performance may not be optimal, however this is meant as easy-to-use
and it shouldn't be an issue in real life. It will be mostly exposed
in two layers:

 - Efl.Loop.coro: will wrap eina_coro and and schedule using its main
   loop instance, returns an Eina_Future so it's easy to chain.

 - Eina_Promise/Eina_Future "async/await"-like behavior: will allow to
   write "synchronous" code that can wait for promises to be
   resolved. When eina_future_await(), it will actually register a new
   Eina_Future in the chain and then eina_coro_yield(). Once the
   future is called back it will call eina_coro_run() and allow the
   coroutine to resume. This is done on top fo eina_coro_await().
2017-08-27 11:47:55 -03:00
..
CMakeLists.txt cmake: fix strlcpy() detection and usage. 2017-01-26 15:53:14 -02:00
Eina.h eina: add Eina_Coro - coroutine support. 2017-08-27 11:47:55 -03:00
eina_abi.c
eina_accessor.c
eina_accessor.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_alloca.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_array.c eina inarray accessor - use right type in parameter 2017-07-29 08:55:27 +09:00
eina_array.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_benchmark.c efl: fix misleading indentation 2016-05-18 21:57:02 +02:00
eina_benchmark.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_bezier.c eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
eina_bezier.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_binbuf.c
eina_binbuf.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_binbuf_template_c.x eina: fix up last commit 2017-01-06 13:02:37 +01:00
eina_binshare.c
eina_binshare.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_clist.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_config.h.cmake cmake: major rework of check and pkg-config dependencies. 2017-01-23 23:55:33 -02:00
eina_config.h.in eina - fix redefinition of word size if already defined 2017-01-06 19:25:50 +09:00
eina_convert.c
eina_convert.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_coro.c eina: add Eina_Coro - coroutine support. 2017-08-27 11:47:55 -03:00
eina_coro.h eina: add Eina_Coro - coroutine support. 2017-08-27 11:47:55 -03:00
eina_counter.c eina: fix same wrong indenting 2016-12-06 17:16:24 +01:00
eina_counter.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_cow.c
eina_cow.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_cpu.c eina_cpu: Fix arm build 2016-10-04 14:29:36 -05:00
eina_cpu.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_crc.c eina: fix same wrong indenting 2016-12-06 17:16:24 +01:00
eina_crc.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_debug.c eina debug - remove other swap and comment on the weirdness of this 2017-08-03 09:08:04 +09:00
eina_debug.h Eina_Debug: Fix config.h usage 2017-06-05 11:49:08 +03:00
eina_debug_bt.c eina debug - don't try and collect stats on more than a million threads 2017-07-23 19:09:11 +09:00
eina_debug_bt_file.c Eina Debug: include Evil for realpath support 2017-06-11 10:03:53 +03:00
eina_debug_chunk.c First patch of the Eina Debug layer rewriting 2017-06-05 08:51:49 +03:00
eina_debug_cpu.c eina debug - add comments to cpu debug using locks to pause sysmon 2017-07-23 18:43:58 +09:00
eina_debug_private.h Fix Windows compilation 2017-06-05 08:55:38 +03:00
eina_debug_thread.c Remove thread management 2017-06-05 08:55:37 +03:00
eina_debug_timer.c eina debug timer - handle fail wakeup write with error complaint 2017-07-23 19:26:56 +09:00
eina_error.c eina: fix behaviour break of eina_error_msg_get() 2016-08-29 20:03:52 +02:00
eina_error.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_evlog.c eina evlog debugging - when freeing debug buf with mmap 0 size after 2017-07-29 09:08:40 +09:00
eina_evlog.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_file.c Eina_File: Avoid using munmap() on file->global_map. 2017-08-02 16:03:20 -07:00
eina_file.h eina: add an API to correctly do close on exec. 2017-04-18 16:53:26 -07:00
eina_file_common.c eina_file: fix unmap of unmapped region when Eina_File has copied data and not a map; 2017-07-07 13:22:53 +09:00
eina_file_common.h eina_file: fix unmap of unmapped region when Eina_File has copied data and not a map; 2017-07-07 13:22:53 +09:00
eina_file_win32.c Eina_File: Avoid using munmap() on file->global_map. 2017-08-02 16:03:20 -07:00
eina_fp.c
eina_fp.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_freeq.c eina freeq - fix possible seg with NULL freeq and pattern fill logic 2017-02-08 08:48:35 +09:00
eina_freeq.h eina: Remove EAPI eina_freeq_main_set() 2017-01-17 14:21:17 +09:00
eina_hamster.c eina hamster count - use a fixed version, revision etc. so builds repro 2017-08-02 17:12:28 +09:00
eina_hamster.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_hash.c efl - fix many bounds over/underflow where we use int for ptr cmp 2016-05-26 12:17:07 +09:00
eina_hash.h eina: Fix broken link in doc to introduce integer hash algorithms 2017-05-30 13:34:34 +09:00
eina_inarray.c
eina_inarray.h eina: inarray: remove documentation pointer to non-existing functions 2017-07-13 11:21:59 +02:00
eina_inline_array.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_clist.x
eina_inline_cpu.x
eina_inline_crc.x
eina_inline_f8p24.x
eina_inline_f16p16.x
eina_inline_f32p32.x
eina_inline_file.x eina_file: move doc block about eina_file_path_join from inline to file.h 2016-03-19 15:57:46 +01:00
eina_inline_fp.x
eina_inline_hash.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_inlist.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_list.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_lock_barrier.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_lock_posix.x eina: fix macos spinlocks and upgrade API to sierra 2016-10-01 21:17:05 +02:00
eina_inline_log.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_mempool.x eina: add an API to check if a pointer is a valid element of a mempool. 2017-08-15 13:46:34 -07:00
eina_inline_modinfo.x eina: module - Add macros for adding module informations 2016-08-31 16:17:53 +05:30
eina_inline_private.h
eina_inline_rbtree.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_rectangle.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_safepointer.x eina: add generic infrastructure for a Eina_Safepointer 2016-06-10 13:57:01 -07:00
eina_inline_slice.x eina: as we use string.h function in this inline function, we better include it. 2017-06-08 11:41:39 -07:00
eina_inline_str.x eina - redo a lot of the static inlines to have better instr cache usage 2016-09-20 14:53:05 +09:00
eina_inline_stringshare.x eina_stringshare: add slice_get() 2016-08-22 18:25:14 -03:00
eina_inline_tiler.x
eina_inline_trash.x
eina_inline_unicode.x
eina_inline_ustringshare.x
eina_inline_util.x eina: move to use memcmp and rename eina_{flt,dbl}eq to eina_{flt,dbl}_exact. 2017-01-06 15:58:46 -08:00
eina_inline_value.x eina_value: add helper: eina_value_struct_desc_get(). 2017-08-24 11:13:56 -03:00
eina_inline_value_util.x eina_value_util: eina_value_X_get() helpers. 2017-08-23 18:32:13 -03:00
eina_inline_vector.x eina vector - fix indenting and 80 col overflow in inline header 2016-05-21 23:37:07 +09:00
eina_inlist.c
eina_inlist.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_iterator.c eina: add free cb to eina_iterator_filter_new 2016-12-09 10:16:08 +01:00
eina_iterator.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_lalloc.c
eina_lalloc.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_list.c eina_list: Ensure single init 2017-07-20 17:47:51 +09:00
eina_list.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_lock.c OSX: fix version detection in build 2017-07-17 13:04:30 +01:00
eina_lock.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_log.c eina_log: make a log level of 0 disable the log domain 2017-06-23 17:43:44 -04:00
eina_log.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_magic.c efl: fix misleading indentation 2016-05-18 21:57:02 +02:00
eina_magic.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_main.c eina: add Eina_Coro - coroutine support. 2017-08-27 11:47:55 -03:00
eina_main.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_matrix.c eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
eina_matrix.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_matrixsparse.c
eina_matrixsparse.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_mempool.c eina: add an API to check if a pointer is a valid element of a mempool. 2017-08-15 13:46:34 -07:00
eina_mempool.h eina: add an API to check if a pointer is a valid element of a mempool. 2017-08-15 13:46:34 -07:00
eina_mmap.c eina mmap - fix warnings thanks to missing include 2017-04-21 16:38:40 +09:00
eina_mmap.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_module.c eina: failing to load a module is actually an ERR that user should see. 2017-08-02 16:16:33 -07:00
eina_module.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_prefix.c
eina_prefix.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_private.h eina: Remove EAPI eina_freeq_main_set() 2017-01-17 14:21:17 +09:00
eina_promise.c eina: add Eina_Coro - coroutine support. 2017-08-27 11:47:55 -03:00
eina_promise.h eina: add Eina_Coro - coroutine support. 2017-08-27 11:47:55 -03:00
eina_promise_private.h Eina: Add Eina_Promise/Eina_Future. 2017-08-25 19:53:49 -03:00
eina_quad.c
eina_quad.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_quadtree.c efl - fix many bounds over/underflow where we use int for ptr cmp 2016-05-26 12:17:07 +09:00
eina_quadtree.h
eina_quaternion.c eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
eina_quaternion.h
eina_rbtree.c eina rbtree iterator - fix leak found while debugging other problems 2016-07-19 15:43:22 +09:00
eina_rbtree.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_rectangle.c eina: add api for assessing the relative position of two rectangles 2016-12-20 16:39:30 -08:00
eina_rectangle.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_refcount.h
eina_safepointer.c eina_safepointer: Fix coverity warning 2016-07-13 16:25:01 +09:00
eina_safepointer.h eina: safepointer: add since tags to new eina safepointer EAPI 2016-08-08 14:59:57 +02:00
eina_safety_checks.c
eina_safety_checks.h
eina_sched.c
eina_sched.h
eina_share_common.c eina share - fix spinlock release if magic check fails on share data 2017-02-08 21:19:39 +09:00
eina_share_common.h
eina_simple_xml_parser.c eina simple xml parser - remove pointless memcmp of 0 bytes 2017-07-29 11:03:01 +09:00
eina_simple_xml_parser.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_slice.h eina: Fix more typo in doxygen 2017-03-13 15:50:37 -04:00
eina_slstr.c eina_slstr: Fix leak in an error case 2017-08-04 10:24:03 +09:00
eina_slstr.h eina: Introduce Eina_Slstr for short-lived strings 2017-01-17 14:20:55 +09:00
eina_str.c eina: fix for escapable charachters not getting escaped if it comes after '\t' or '\n' 2017-05-09 10:37:16 -07:00
eina_str.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_strbuf.c eina_buf: replace eina_strbuf_free_return with eina_xXxbuf_release 2017-01-06 12:45:27 +01:00
eina_strbuf.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_strbuf_common.c eina_binbuf: allow expand & usage of extra bytes. 2016-12-20 10:18:32 -02:00
eina_strbuf_common.h eina_binbuf: allow expand & usage of extra bytes. 2016-12-20 10:18:32 -02:00
eina_strbuf_template_c.x
eina_stringshare.c
eina_stringshare.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_thread.c First patch of the Eina Debug layer rewriting 2017-06-05 08:51:49 +03:00
eina_thread.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_thread_queue.c Revert "eina threadqueue - for paranoia lock+ulock+free in order locks taken" 2016-08-11 15:25:32 +02:00
eina_thread_queue.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_tiler.c eina: fix eina_tiler_equal to not always return true 2017-07-14 18:43:00 -04:00
eina_tiler.h eina: make tiler function params const where appropriate 2017-07-14 18:43:00 -04:00
eina_tmpstr.c
eina_tmpstr.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_trash.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_types.h eina: enable fallthrough warning suppression only on GCC 7 and above. 2017-06-06 09:57:14 -07:00
eina_unicode.c
eina_unicode.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_ustrbuf.c eina: fix compilation warning on _WIN32 due missing strndup() 2017-03-29 12:44:19 -03:00
eina_ustrbuf.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_ustringshare.c
eina_ustringshare.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_util.c eina utils: fix build without getpwent. 2017-02-20 11:29:56 +02:00
eina_util.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_value.c Eina_Value type EINA_value. 2017-08-23 18:32:13 -03:00
eina_value.h eina_value: add helper: eina_value_struct_desc_get(). 2017-08-24 11:13:56 -03:00
eina_value_util.c
eina_value_util.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00
eina_vector.h evas: Update eina_vector, add new function. 2016-02-17 16:12:35 +09:00
eina_xattr.c eina: fix compilation warning on _WIN32 due missing strndup() 2017-03-29 12:44:19 -03:00
eina_xattr.h docs: Fix typos and some wrong expressions in Eina API reference doxygen. 2017-02-21 10:46:28 +09:00