Commit Graph

680 Commits

Author SHA1 Message Date
Myoungwoon Roy, Kim 0f446c10be doxygen: fix typos, cacologique statements in API reference doxygen of Ecore_Common
Summary: There are some typos and calogique statements in doxygen of Ecore_Common so I had fixed typos, cacologique statements.

Test Plan: doxygen revision

Reviewers: stefan, cedric, raster, Jaehyun_Cho

Subscribers: conr2d, jpeg

Differential Revision: https://phab.enlightenment.org/D4650

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-08 11:09:18 -08:00
Cedric BAIL 4f2af24755 ecore: reset during timer callback execution doesn't make sense.
@fix
T3222
2017-02-07 16:39:02 -08:00
Carsten Haitzler 51c7c9bc99 ecore thread - up default 3 of thread workers to 4x cpu cures
this ups it from number of cpu cores to 4 times that (so if threads to
blocking i/o the spare cycles can be used up).
2017-02-08 08:48:35 +09:00
Myoungwoon Roy, Kim 1f1d52503e doxygen: fix typo, cacologique expressions in API reference doxygen.
Summary: Fix typos, cacologique expressions in Ecore API reference doxygen.

Test Plan: doxygen

Reviewers: stefan, cedric, raster, Jaehyun_Cho

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4646

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-07 13:28:50 -08:00
Cedric BAIL a8eeca3c2f ecore: make sure we always manipulate a valid timer. 2017-02-06 15:35:48 -08:00
Felipe Magno de Almeida 8054037992 efl: add composite model for boolean properties
Add Efl.Model.Composite.Boolean, a model for wrapping another Efl.Model and
adding boolean properties to its children.
Children of the given composite model will have the boolean properties
specified in Efl.Model.Composite.Boolean with the specified default value.
A call to Efl.Model.Property_set can change the property value for a child.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-06 15:26:27 -08:00
Larry Jr 093c592188 efl: add efl_model and efl_ui_view classes
Efl.Model.Container and Efl.Model.Item to efl/interfaces are used
to create Efl.Model objects with predefined property values.
This is useful to any situation where we want an Efl.Model with
explicit defined property values.

Efl.Ui.View and Efl.Ui.Factory are used to connect Efl.Models with
Widgets, Elm.Layout and Efl.Ui.Image has changed to use news interfaces

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-06 15:26:21 -08:00
Cedric BAIL de83cc77d3 ecore: handle initialization of timer correctly. 2017-02-06 14:29:56 -08:00
Chidambar Zinnoury cece2b53d7 ecore thread: Fix waiting.
Waiting would sometimes return as if the thread finished correctly while it is still running.

 This is because we’re waiting for the waiter data to be null… but this is always the case if the user-passed data is null!

 @fix
2017-02-04 23:44:31 +01:00
Cedric BAIL 7819333875 ecore: poller could actually be related to the main loop timing.
Reduce call to ecore_time_get which is a syscall to gettimeofday.
2017-02-03 13:05:44 -08:00
Gustavo Sverzut Barbieri 8dc853f230 ifdef RUN_IN_TREE logic.
This logic is only needed for autotools, cmake will replicate the
installation file structure and thus eina_prefix works out of box.
2017-02-03 12:36:38 -02:00
Cedric BAIL f66559a4cd ecore: avoid calling ecore_time_get everytime we create a timer.
This is particularly useful for ecore_timer_loop_add which are not
supposed to trigger any syscall. It does add a new requirement
on the EFL_LOOP_TIME_CLASS to always have an interval defined during
construction.
2017-02-02 16:56:57 -08:00
Gustavo Sverzut Barbieri f958921177 cmake: add ecore.
no tests or modules (which depend on eldbus).
2017-01-25 19:29:20 -02:00
Jean-Philippe Andre 4550b4cf83 eina: Introduce Eina_Slstr for short-lived strings
Built on top of the new 'postponed' free queue, the short-lived
strings API allows users to return new strings without caring
about freeing them. EFL main loop will do this automatically for
them you at a later point in time (at the end of an iteration).

The APIs provided will either duplicate (copy) or more generally
steal an existing string (char *, stringshare, tmpstr, strbuf),
taking ownership of it and controling its lifetime. Those strings
can then be safely returned by an API. From a user point of view,
those strings must be considered like simple const char *, ie.
no need to free() them and their validity is limited to the
local scope.

There is no function to remove such a string from the freeq.

The short lived strings API is not thread-safe: do not send a
short-lived object from one thread to another.

@feature
2017-01-17 14:20:55 +09:00
Daniel Kolesa 85fbc333dd eolian: enforce specification of both get and set in prop impls
Now you can't use the same syntax as you would for a method to
implement a property as whole, instead you need to specify the
getter and/or setter explicitly. This is to allow parent classes
to expand their properties without altering behavior of the child
classes.
2017-01-11 16:38:41 +01:00
Cedric BAIL 8f1c071d6a eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
Marcel Hollerbach f32486ced5 ecore_thread: reset waiter and worker when we have failed
otherwise the func_end and func_cancel can get into a endless recursion.
2016-12-28 12:19:40 +01:00
Marcel Hollerbach 46131ea80c ecore_thread: null out the struct before returning it
it can contain old callback values which are not overwritten in every
case. This just ensures that in both cases, empty trasher or none empty
trasher, are returning the same state of the struct.
2016-12-27 17:55:25 +01:00
Daniel Kolesa c4cb70199f ecore: use new property impl syntax 2016-12-27 16:19:06 +01:00
Andrii Kroitor ea66c8302a ecore_main: don't wait on marked to delete handlers on Windows
This could lead to greedy wait with 100% CPU consumption because on wait
error we never reach actual handlers deletion.
2016-12-27 15:52:33 +02:00
Andrii Kroitor 792acc9f9e ecore_exe: do not try to send 0 bytes
Summary: This action is meaningless when communicating with child process.

Reviewers: barbieri

Reviewed By: barbieri

Subscribers: jpeg, vtorri, cedric, raster

Differential Revision: https://phab.enlightenment.org/D4510
2016-12-22 19:28:44 +02:00
Andrii Kroitor 7e156742b3 ecore_exe_win32: fix typo in input poll thread 2016-12-22 14:39:33 +02:00
Andrii Kroitor 11e687578d ecore_exe: fix send on Windows
Check for bytes written only if more than 0 bytes were sent.
I don't know why some efl code is trying to send 0 bytes, but that works on
Linux and therefore should be fixed on Windows.
2016-12-22 14:13:40 +02:00
Andrii Kroitor 053613db52 ecore: fix wait for stdin on Windows
We can't directly wait on stdin handle because it is signaled imediatly even
if there is no new data on input stream.
2016-12-22 14:13:40 +02:00
Andrii Kroitor bceb263910 ecore_exe is broken on Windows
Summary:
T4938

diff from @raster
Aaaargh! There is no other way to get code from diff on phab..

Reviewers: vtorri

Subscribers: vtorri, i.furs, cedric, jpeg, raster

Differential Revision: https://phab.enlightenment.org/D4448
2016-12-22 11:11:02 +09:00
Cedric BAIL ef166eff14 ecore: we need to process future and promise before the internal start loop. 2016-12-21 11:36:42 -08:00
Gustavo Sverzut Barbieri fd6dbe3393 efl_io_buffered_stream: eos-mark and flush sender on close.
By marking EOS on the outgoing queue we allow the sender to flush
pending data if that's possible.

This also fixes a typo in the condition for eos_mark, it operates on
outgoing, not incoming queue.
2016-12-20 10:18:33 -02:00
Gustavo Sverzut Barbieri c152aad8c5 efl_io_reader/writer: silent errors when operating on unset-objects.
if we're operating on unset objects, fd are now -1 and would complain,
relax that.
2016-12-20 10:18:33 -02:00
Gustavo Sverzut Barbieri 4d5105afeb efl_io_buffered_stream: if there is a copier, check if it's done.
Before we're exiting if there was nothing pending, but in some cases
this was too aggressive as the copier's source may be alive (ie:
not-EOS), however nothing was read to its internal buffer, thus no
pending.

Since the copier will track its source's EOS, just check if it's done.
2016-12-20 10:18:32 -02:00
Gustavo Sverzut Barbieri 829d1d71fb efl_io_copier: fix typo in efl_io_copier_flush().
We should check if destination 'can write', not source.
2016-12-20 10:18:32 -02:00
Gustavo Sverzut Barbieri 08c38713ce do not emit events from efl_io_closer_close() on destructor.
On destructor we're not supposed to emit events, I even thought that
would be implicit, but it's not. If we do, for example an event
handler that would 'efl_del()' on "EFL_IO_CLOSER_EVENT_CLOSED" would
trigger too-many unrefs.
2016-12-20 10:18:32 -02:00
Gustavo Sverzut Barbieri 963e3a793d efl_io_reader/writer: always set 'can_*' to FALSE on errors.
If user tries to read or write and that fails then set 'can_read' or
'can_write' to false, regardless of the error code.
2016-12-20 10:18:32 -02:00
Gustavo Sverzut Barbieri 2666e927a5 efl_io_copier: avoid extra copy, todo--.
Avoid the intermediate buffer and use the new eina_binbuf_expand() +
eina_binbuf_use(), reading directly to the binbuf.
2016-12-20 10:18:32 -02:00
Gustavo Sverzut Barbieri 22837eacc9 efl_io_copier: remove TODO leftovers.
Copier is based on Efl.Io.Reader.can_read,changed and
Efl.Io.Writer.can_write,changed, these events do not keep being posted
until it's actually read/written, instead they trigger only once when
the property change -- unlike Efl.Loop_Fd read/write events.
2016-12-20 10:18:32 -02:00
Cedric BAIL 77a7d6d9e5 ecore: remove float comparison warning from Ecore_Animator code. 2016-12-19 16:33:46 -08:00
Cedric BAIL 1a6dc04fa1 ecore: remove float comparison warning from Ecore_Poller code. 2016-12-19 16:33:46 -08:00
Cedric BAIL 667b4340b9 ecore: remove floating point comparison warning from Ecore_Thread code. 2016-12-19 16:33:46 -08:00
Cedric BAIL 0a05725cc1 ecore: remove floating point comparison warning from Ecore main loop code. 2016-12-19 16:33:46 -08:00
Cedric BAIL 172c07d5cd ecore: remove float comparison warning from Ecore_Pipe. 2016-12-19 16:33:46 -08:00
Gustavo Sverzut Barbieri dd5cdda64b more eo simplified to use Eina_Slice instead of pointer to.
Working directly with Eina_Slice is easier than a pointer to it,
requires no validation of the pointers and is cheap since it's just
putting together size_t + void*.

However we can't hint the user of 'const(Eina.Slice)' properties as
Eolian is incorrectly generating getters as:

   const Eina_Slice class_property_get(...)

which is makes compilers complain about ignored qualifiers:

   ../src/lib/ecore/efl_io_copier.eo.h:329:7: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]

Leave some TODO so @q66 can fix those.
2016-12-19 15:30:56 -02:00
Gustavo Sverzut Barbieri 25a9e1d886 Efl.Io.{Queue,Buffer,Buffered_Stream}: slice_get is now a property.
Previously we couldn't return a slice, instead required the user to
pass a slice and we'd fill it since Eolian couldn't generate fallbacks
for structures.

Since @q66 fixed eolian, we can now return the structure itself as
initially wanted, ditching some TODO from the code.
2016-12-19 15:30:56 -02:00
Gustavo Sverzut Barbieri fe668ef52c efl_io_file: initialize all fd to -1.
Since 0 is a valid fd, we should initialize these to -1.
2016-12-19 13:03:33 -02:00
Cedric BAIL 637073813b ecore: add helper to automatically connect a future result to a promise.
This helper is to be used likely with next and an external request.
2016-12-16 14:10:58 -08:00
Cedric BAIL ca1762be21 ecore: delay promise fulfillment to next loop iteration. 2016-12-16 14:10:58 -08:00
Cedric BAIL b85332fc89 ecore: remove useless information from header. 2016-12-16 10:42:59 -08:00
Cedric BAIL 5882c30a98 ecore: refactor promise propagation code. 2016-12-16 10:19:37 -08:00
Daniel Kolesa c813e94606 eolian: unary expr eval for floats and add a signed number mask
This adds a new mask for all signed numbers (sint + float) and
fixes unary expr evaluation for floats, as well as fixes eval
error messages.
2016-12-14 18:23:16 +01:00
Jean-Philippe Andre bcb251e6ab evas: Make evas object loop users
This makes efl_loop_get() work on evas objects, returning the
main loop as expected. Also make the loop a property of the
Loop_User class (shouldn't it be called Efl.Loop.User instead?)
2016-12-13 16:12:27 +09:00
Gustavo Sverzut Barbieri 47ddca0f42 Efl_Future: class name (string) using "." for namespace.
Following recent eolian change, the string must have "." to split
namespace, not "_".
2016-12-12 02:30:33 -02:00
Gustavo Sverzut Barbieri 21759f713a yoda-style inactivity timeout.
s/inactivity_timeout/timeout_inactivity/g so it matches the EFL names
with scope first, like timeout_connect, etc.
2016-12-12 02:30:33 -02:00
Gustavo Sverzut Barbieri e5b3d43c4f efl_io_closer_fd: fix warning on windows. 2016-12-09 19:12:33 -02:00
Gustavo Sverzut Barbieri 83cbcf7cb5 efl_io_copier: callbacks may close the copier.
direct or indirect events may trigger the user to close the buffer.
2016-12-09 13:47:04 -02:00
Gustavo Sverzut Barbieri 47f9d06d0b efl_io_buffered_stream: del inner_io if we're the parent.
This is a nice convenience if inner_io was reparented to the wrapper.
2016-12-09 13:47:04 -02:00
Jihoon Kim fdbc5a4019 Fix typo in doxygen about ecore_idler_add 2016-12-09 19:58:54 +09:00
Gustavo Sverzut Barbieri 994d66513f efl_io_buffered_stream: better detection of 'finished' state.
When used with sockets, if it's EOS (ie: remote peer terminated the
connection), but not closed, then it would not emit 'finished' event.

Now it does.
2016-12-08 11:40:45 -02:00
Gustavo Sverzut Barbieri c33ed61e17 efl_io_copier: expose pending_size and add debug to done_get.
In some cases the copier isn't done but you know there is not more
data to arrive at it, then you want to know if all pending data was
flushed from the copier's intermediate buffer to the destination, if
so you can call it closed yourself.
2016-12-08 11:40:45 -02:00
Gustavo Sverzut Barbieri bb5f91273c efl_io_buffered_stream: property and event 'progress'
useful to get feedback on when data was actually sent/received, and
how much.
2016-12-08 11:40:45 -02:00
Andrii Kroitor 52d4313bb6 ecore_exe: fix ecore_exe_send on Windows
Do not repeat already sent data.
Remove pipe_write.data_buf because data was sent directly anyway and it was
used only in this method.
2016-12-08 15:18:46 +02:00
Andrii Kroitor 6f6323d12e Revert "exore_exe: fix from @raster"
This reverts commit c505b754ce.

Accidentally pushed this with build fix. Sorry :(
This commit is related to T4938 and it's goint to be updated, checked and pushed later.
2016-12-08 14:16:38 +02:00
Andrii Kroitor c505b754ce exore_exe: fix from @raster 2016-12-08 14:07:02 +02:00
Vyacheslav Reutskiy 299471991c ecore_exe_win32: fix ecore_exe_send
Write to the child pipe corect data size.
@fix
2016-12-02 11:50:39 +02:00
Carsten Haitzler b3361f1aad ecore exe - handle scope data get null returns when ppl do bad things
peolpe using ecore_exe in threads... for example.
2016-12-01 08:49:25 +09:00
Jee-Yong Um 0e2a2cbacf eolian: remove all duplicated affix
Summary:
Currently eolian abbreviates when only the last word of class name and
the first word of method name are same, but this patch abbreviates
generated c name of function to remove all duplicated affix.
For example, "efl_io_closer_fd_closer_fd_set" will be "efl_io_closer_fd_set".

Reviewers: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D4430

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-11-28 11:35:27 -08:00
Carsten Haitzler 81242af6f9 ecore animator - timer based ticker - add epoll support if available
the ecore time based animator that ticked away used select for
timeouts to listen to either a timeout OR the control fd that would
tell it to tick or not tick. my profiles show this as consuming 1.03%
of my profile sample time - just  the select call in the time based
animator. this adds the option of epoll + timerfd + having kernel
repeat the timer fd interval (since epoll timeouts at best can do 1ms
resolution). my profiling shows this to use 0.62% of profile time vs
1.03% for select, so it's a tiny win. this only compiles if epoll and
timerfd support have already been detected at compile time. it also
runtime falls back to select if epoll and timerfd setup fail.

@optimize
2016-11-27 17:21:51 +09:00
Gustavo Sverzut Barbieri 46341b329d efl_io_buffered_stream: wraps an I/O object and make it easy to use.
Since all other efl.io objects are low-level, the recommended approach
is to use an efl.io.copier. However when dealing with in-memory,
bi-directional comms like talking to a socket, we always end with 2
queues, 2 copiers and the annoying setup that is being replicated in
ecore_ipc, efl_debug and so on.

This class is the base to make it simpler. Other classes such as
Efl.Net.Socket.Simple, Efl.Net.Dialer.Simple and Efl.Net.Server.Simple
will use it to provide simpler code to users.

I guess we can call EFL+EO Java now?
2016-11-25 17:27:32 -02:00
Gustavo Sverzut Barbieri 16be61c7e1 efl_io_copier_flush: add may_block and ignore_line_delimiter parameters.
The may_block parameter is useful to force a flush without blocking on
read/write, sometimes particularly useful if ignore_line_delimiter is
true, then you get the data events without blocking -- as if a server
sending some content misses a trailing line delimiter, you do not want
to block on recv() but still want to flush data to user.

The ignore_line_delimiter parameter is useful if we're going to close
the copier and want to flush pending data which may exist due missing
trailing terminator. The close method will also force that if
destination can take more data.
2016-11-25 17:25:18 -02:00
Gustavo Sverzut Barbieri d9dafab785 efl_io_copier: expose 'done' property.
This property has a protected setter and will simplify both internal
implementation as well as usage.
2016-11-25 17:25:18 -02:00
Gustavo Sverzut Barbieri 4b28d5a989 docs: enhance efl_io_copier.
This is the core component of our new I/O subsystem, heavily used by
efl.net and the likes. Then make sure the documentation is good :-)
2016-11-24 15:22:45 -02:00
Stefan Schmidt d859d693be docs: efl_io_copier: fill gaps in eo file documentation 2016-11-24 15:33:10 +01:00
Gustavo Sverzut Barbieri 49399b385b efl_io_std{in,out,err}: do not spin on fd monitoring events.
as soon as we report 'can_read' or 'can_write', stop monitoring the
events until the user executes the operation, which will clear these
flags and we resume monitoring.
2016-11-24 02:11:56 -02:00
Cedric Bail b5fedfad7e ecore: use mempool for legacy idler allocation. 2016-11-23 18:50:19 -08:00
Gustavo Sverzut Barbieri 906bf6abf0 efl_loop_fd: more efficiently manage the Ecore_Fd_Handler.
instead of always delete and recreate it, modify if it already exists
and only delete if it's not needed anymore.

This results in epoll_ctl() to modify an existing handle, instead of
add one.
2016-11-24 00:30:02 -02:00
Gustavo Sverzut Barbieri 0a8fd379db efl_loop_fd: reduce number of _efl_loop_fd_reset()
When we're adding callbacks in an array, we may reduce 3 epoll_ctl()
to a single one.
2016-11-24 00:21:54 -02:00
Gustavo Sverzut Barbieri f1b94bdf7b efl_loop_fd: fix comparison that was breaking callback deletion.
Either we "--var" or we compare with "> 1" instead of "> 0", otherwise
callback_del will keep the flags set.
2016-11-24 00:17:59 -02:00
Gustavo Sverzut Barbieri 44d95dd408 efl_io_copier: do not emit data events if no data is available. 2016-11-23 12:57:10 -02:00
Gustavo Sverzut Barbieri 5c961bba9b efl_io_copier: add flush method.
This method will force a read-write cycle and returns if it's fully
done or not. It may be used to force data to be written before a
handle is deleted (when one can't wait for the data to be written
asynchronously).
2016-11-23 12:57:10 -02:00
Stefan Schmidt 242edea752 docs: ecore: add missing property doc for efl_io_file 2016-11-17 13:08:41 +01:00
Stefan Schmidt 6a322b1b2c docs: ecore: finish up eo file docs in ecore 2016-11-11 10:58:22 +01:00
Carsten Haitzler 2f6045abc0 ecore - add run state evlogs to know when we run (mainloop) or sleep 2016-11-10 16:22:34 +09:00
Cedric BAIL 08c3102dc0 ecore: remove ecore_thread_promise_run. 2016-11-07 10:49:02 -08:00
Carsten Haitzler 895f56aa64 ecore main loop - drive the free queue from the loops idle enterer
this will drive the free queue and make sure an idler will run through
pending frees once the loop has gone idle.
2016-11-06 13:13:10 +09:00
Cedric BAIL 832873259c ecore: fix efl_future_all/race to be setup on already fulfilled future. 2016-11-03 18:03:16 -07:00
Cedric BAIL 59a635d251 ecore: make call to future_get and value_set irrelevant as they should be. 2016-11-03 18:03:16 -07:00
Daniel Kolesa 8841f7e781 ecore_exe: remove pointers 2016-11-03 17:03:14 +01:00
Daniel Kolesa 54ad4f24d2 efl_io_copier: remove pointers 2016-11-03 17:02:24 +01:00
Daniel Kolesa d773f33612 efl_loop: remove pointers 2016-11-03 17:01:31 +01:00
Stefan Schmidt 42426735e8 docs: ecore: document various type defines 2016-11-03 11:57:40 +01:00
Gustavo Sverzut Barbieri 9a13816fb3 efl_io_copier: do not ERROR on EAGAIN.
As done by write, if we try to read and we can't, then don't give
up. This happens with streams that wraps another, like SSL, may report
there are data to read, but once you try it may not result in enough
data to upper layers.
2016-10-31 19:38:22 -02:00
Gustavo Sverzut Barbieri c05152fcd4 ecore_getopt: allow empty strings as parameters.
Sometimes we want to specify an empty string, that should be allowed.
2016-10-31 19:38:22 -02:00
Carsten Haitzler 973eaedf51 improve responsivness of timer sleeping threads for vsync with prctl
prctl allows us on some platforms to request a thread be woken up more
agressively e.g. due to a timeout bu setting timerslack. since we use
a dedicated thread just for vsync events, this is a very good idea to
ask the kernel to be as exact as possible for this thread as it only
wakes up once per frame (or should only) and accuracy is important. so
use this.

also improve prctl checks to be more explicit in configure.ac and use
these ifdefs in ecore exe too where prctl is used as well.

@feature
2016-10-28 22:58:36 +09:00
Carsten Haitzler da04400c5d ecore-animator allow for animator to skip queued animator ticks
set ECORE_ANIMATOR_SKIP to skip queued animtor ticks if multiple are
in the pipeline. optional and not on by default. i would think its not
a good idea to skip these animator ticks and skipping/deferring is a
job higher up.

@feature
2016-10-28 13:58:56 +09:00
Stefan Schmidt b889beb0fc docs: ecore: document missing structs 2016-10-27 18:22:41 +02:00
Gustavo Sverzut Barbieri 564e499467 ecore_init() use getenv(ECORE_NO_SYSTEM_MODULES) and disable those.
Sometimes during debug of efl_net we get some "extra" sockets from
DBus to talk to upower, localed, timedated... which are helpful in
real life, but pollutes debugging.

Since I don't want to contaminate examples with
ecore_app_no_system_modules(), which could lead users to naively copy
those and end without the system modules features, add an envvar that
I can define in my tests when I need them.
2016-10-27 09:33:09 -02:00
Gustavo Sverzut Barbieri 574e4b8ad5 efl_io_copier: work around efl_future weirdness.
The pointer given to efl_future_use() should be NULL-ified before
calling my function, since that pointer has no meaning anymore.

The copier relied on pd->job being NULL to avoid useless rescheduling,
it was being reached with non-null, but that pointer is no longer
useful.

Moreover, I'm not sure if the second pointer, with the new future
won't be modified to NULL when the efl_future continues :-(
2016-10-26 23:19:46 -02:00
Cedric Bail bfcc66e4eb ecore: allow multiple nested recursion of the same promise/future to happen at the same time. 2016-10-25 18:50:35 -07:00
Cedric Bail 919829aa7d ecore: properly handle promise failure when each member has not been fulfilled yet. 2016-10-25 15:35:13 -07:00
Lauro Moura 6aa4486209 ecore: Add _SAFE when iterating the animators.
In some cases (like JS libuv events) an animator callback can trigger the
deletion of an animator, changing the list being iterated.
2016-10-25 12:23:34 -02:00
Stefan Schmidt f4ae4bfb69 docs: ecore: make consistent use of $true and $false keywords in docs 2016-10-24 17:21:48 +02:00
Gustavo Sverzut Barbieri bcd60581eb efl_io_copier: on close, emit "done" if still pending.
done event must be emitted before "closed" in order to notify it won't
do anything else.
2016-10-22 12:04:25 -02:00
Gustavo Sverzut Barbieri 5e54c3aa57 efl_io_copier: add inactivity_timeout.
This is handful to error the copier with ETIMEDOUT if there are no
reads or writes in the given amount of time.

Since copiers are usable to download data or handle network clients,
it's easy to set a timeout and disconnect, let's say UDP clients that
are gone.
2016-10-22 10:52:22 -02:00
Cedric Bail 6321630d32 ecore: force fully resolve a future on cancel during recursive call. 2016-10-21 12:44:53 -07:00
Carsten Haitzler 681d47a6c1 ecore anim - actually fix by checking fd not thread handle
this should remove a 0.5 sec or so pause at shutdown of efl apps.

@fix
2016-10-21 09:39:00 +09:00
Carsten Haitzler 522c3d7b75 eocre animator - the anim thread is polled on shutdown use volatile
we sit in a loop wating for animator thread to die on shutdown
(sleeping for 1000us), so make it a volatile so every check actually
checks and doesnt cache.

@fix
2016-10-21 07:40:34 +09:00
Gustavo Sverzut Barbieri aba1223145 efl_io_copier: always cancel job on destructor.
It's already deleted on close(), but that's now optional
(close_on_destructor).
2016-10-20 18:49:41 -02:00
Cedric BAIL fb1feee480 ecore: allow efl_future_cancel on a promise currently being resolved.
This is necessary for allowing proper handling of recursive cancel.
2016-10-19 13:39:10 -07:00
Cedric BAIL efda7d492d ecore: handle recursive trigger of promise by the cancel of a future.
This avoid double free/double callback call.
2016-10-18 16:49:48 -07:00
Derek Foreman 7785bfa167 ecore: replace arbitrary time with 32-bit safe arbitrary time
The end of time is much closer than you think.  it_value.tv_sec is
a signed 32-bit number on 32-bit machines. Using a negative tv_sec
causes timerfd_settime() to fail.
2016-10-18 15:52:56 -05:00
Marcel Hollerbach f63ede4281 ecore: free futures which are still pending on shutdown
otherwise we are leaking a eina list.

This was discovered while running the elm_suite with CK_FORK=no, since
ecore and eina are init´ed and shutdown´ed, after the shutdown this list
points to freeed memory pools. So in the next testcase the list is
invalid and crashes. This fixes it with freeing the list on shutdown.
2016-10-13 10:33:22 +02:00
Guilherme Iscaro 2d1e7ff927 Ecore_Thread: Avoid compiler warning
Use PRIuPTR to print the Eina_Thread handle.
2016-10-10 14:20:47 -03:00
Jean-Philippe Andre 7f6f282210 Efl.Loop.User: Use prefix to rename efl_loop_user_loop_get
efl_loop_user_loop_get is idiotic. efl_loop_get should be good enough.
2016-10-06 12:24:59 +09:00
Cedric BAIL 6c514dddb3 ecore: add a prototype ecore_thread helper with Efl_Promise/Efl_Future coupled. 2016-09-26 16:35:52 -07:00
Tom Hacohen 65367a4a07 Ecore promise: Renamed shadow variable.
Please everyone, use -Wshadow and fix your damn wranings.
2016-09-26 14:50:45 +01:00
Cedric BAIL 72f0bfa224 ecore,ecore_con: simplify destructor by linking future life cycle with object. 2016-09-21 16:19:53 -07:00
Jaehwan Kim 1bfb19b457 ecore: fix the parameter of strerror 2016-09-20 13:45:36 +09:00
Cedric BAIL e4958e9faa ecore: remove useless ecore_parent.eo. 2016-09-19 13:05:32 -07:00
Gustavo Sverzut Barbieri f42e649476 efl_promise: check NULL before calling.
we do not check any of success, failure or progress, so we must check
if they are valid before calling.

This fixed a bug in efl_net_dialer_tcp where it uses a null failure
cb and was SEGV.
2016-09-19 01:18:14 -03:00
Cedric Bail 03797a33ab ecore,ecore_con: fix migration to efl_future.
Efl_Future actually work with weak reference. So you do not need to
set things to NULL, but you actually need to register the memory location
of the future with efl_future_use.
2016-09-16 19:13:59 -07:00
Gustavo Sverzut Barbieri 6e12d4f86c efl_io_file: unbreak windows build (missing O_CLOEXEC).
To avoid many ifdef, define the flag to 0 so we "| 0" or "& ~0", that
have no effect.

Fixes T4612.
2016-09-16 07:26:54 -03:00
Cedric Bail 802b146038 ecore_con: forgotten update of Eina_Promise to Efl_Future convertion due to git rebase. 2016-09-15 21:51:15 -07:00
Cedric Bail 95093095f3 ecore_con: migrate use of Eina_Promise to Efl_Future. 2016-09-15 21:49:08 -07:00
Cedric Bail dfc65aef6e ecore: migrate job and timeout to use future. 2016-09-15 21:49:08 -07:00
Cedric Bail f8fd97cd02 ecore: shut up const warning. 2016-09-15 21:49:08 -07:00
Cedric Bail b421414e55 ecore: do not trigger future,none once value/cancel has been set.
This would have forced who ever used future,none signal to manually
filter out event triggered by all the future beeing fullfiled and
disconnecting once they receive a value or are marked failed.
2016-09-15 21:49:08 -07:00
Gustavo Sverzut Barbieri 960e1a1d16 eina/ecore: allow threads to be canceled, use in ecore_con.
As discussed in the mailing list, many people will use worker threads
to execute blocking syscalls and mandating ecore_thread_check() for
voluntary preemption reduces the ecore_thread usefulness a lot.

A clear example is ecore_con usage of connect() and getaddrinfo() in
threads. If the connect timeout expires, the thread will be cancelled,
but it was blocked on syscalls and they will hang around for long
time. If the application exits, ecore will print an error saying it
can SEGV.

Then enable access to pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)
via eina_thread_cancellable_set(EINA_TRUE), to pthread_cancel() via
eina_thread_cancel(), to pthread_cleanup_push()/pthread_cleanup_pop()
via EINA_THREAD_CLEANUP_PUSH()/EINA_THREAD_CLEANUP_POP() and so on.

Ecore threads will enforce non-cancellable threads on its own code,
but the user may decide to enable that and allow cancellation, that's
not an issue since ecore_thread now plays well and use cleanup
functions.

Ecore con connect/resolve make use of that and enable cancellable
state, efl_net_dialer_tcp benefits a lot from that.

A good comparison of the benefit is to run:

   ./src/examples/ecore/efl_io_copier_example tcp://google.com:1234 :stdout:

before and after. It will timeout after 30s and with this patch the
thread is gone, no ecore error is printed about possible SEGV.
2016-09-14 01:47:23 -03:00
Gustavo Sverzut Barbieri ea7bc821d5 efl_io_closer: add close_on_exec and close_on_destructor properties.
the purpose of these properties are to make it more uniform the
handling of these auto-close behavior.
2016-09-12 13:18:28 -03:00
Cedric BAIL e8fb89c156 ecore: fix reference counting of promise value for efl_future_race and efl_future_all. 2016-09-09 16:22:55 -07:00
Tom Hacohen 284b6a5a3e Update the EFL according to new Eo API changes.
I didn't expect it (my bad), but why the hell is this done manually
instead of using Eolian?! People, use Eolian.
2016-09-09 11:25:12 +01:00
Cedric BAIL bd362b13d6 efl: add documentation and last cleanup of the API. 2016-09-08 15:16:43 -07:00
Cedric BAIL f1c8c82e5f ecore: fix parenting to be done right on promise and future. 2016-09-08 15:16:43 -07:00
Cedric BAIL cb17d46cf5 ecore: fix optional future promise to not complain of there destruction. 2016-09-08 15:16:42 -07:00
Cedric BAIL aaac15126b ecore: add efl_future_iterator_race. 2016-09-08 14:58:06 -07:00
Cedric Bail 0789156c86 ecore: add efl_future_race. 2016-09-08 14:58:06 -07:00
Cedric BAIL 56df83e2c0 ecore: add efl_future_iterator_all. 2016-09-08 14:58:06 -07:00
Cedric Bail 84958dc6ca ecore: add efl_future_all. 2016-09-08 14:58:05 -07:00
Cedric Bail cd6a8aa6b3 ecore: add support for optional futures. 2016-09-08 14:58:05 -07:00
Cedric BAIL b2fb5e375a ecore: add Efl.Promise. 2016-09-08 14:58:05 -07:00
Carsten Haitzler 09f19c3c73 eo - make eo id table TLS private data for thread safety and speed
This moved all the eoid tables, eoid lookup caches, generation count
information ad eo_isa cache into a TLS segment of memory that is
thread private. There is also a shared domain for EO objects that all
threads can access, but it has an added cost of a lock. This means
objects accessed outside the thread they were created in cannot be
accessed by another thread unless they are adopted in temporarily, or
create4d with the shared domain active at the time of creation. child
objects will use their parent object domain if created with a parent
object passed in. If you were accessing EO (EFL) objects across threads
before then this will actually now cause your code to fail as it was
invalid before to do this as no actual objects were threadsafe in EFL,
so this will force things to "fail early".
ecore_thread_main_loop_begin() and end() still work as this uses the
eo domain adoption features to temporarily adopt a domain during this
section and then return it when done.

This returns speed back to eo brining the overhead in my tests of
lookup for the elm genlist autobounce test in elementary from about
5-7% down to 2.5-2.6%. A steep drop.

This does not mean everything is perfect. Still to do are:

1. Tests in the test suite
2. Some API's to help for sending objects from thread to thread
3. Make the eo call cache TLS data to make it also safe
4. Look at other locks in eo and probably move them to TLS data
5. Make eo resolve and call wrappers that call the real method func do
   recursive mutex wrapping of the given object IF it is a shared object
   to provide threadsafety transparently for shared objects (but adding
   some overhead as a result)
6. Test test est, and that is why this commit is going in now for wider
   testing
7. Decide how to make this work with sending IPC (between threads)
8. Deciding what makes an object sendable (a sendable property in base?)
9. Deciding what makes an object shareable (a sharable property in base?)
2016-09-07 18:17:10 +09:00
Tom Hacohen 9c779dca90 Rename efl_self to efl_added
It has been discussed on the ML (thread: "[RFC] rename efl_self") and
IRC, and has been decided we should rename it to this in order to avoid
confusion with the already established meaning of self which is very
similar to what we were using it for, but didn't have complete overlap.

Kudos to Marcel Hollerbach for initiating the discussion and
fighting for it until he convinced a significant mass. :)

This commit breaks API, and depending on compiler potentially ABI.

@feature
2016-09-05 16:59:56 +01:00
Gustavo Sverzut Barbieri 4ee09c5bdb efl_io_copier: keep extra ref when calling back from job.
while in a job we do not have the safety of eo holding us alive and
when we call back the user, he may have deleted the object, releasing
both the object and its private data that we're using.

then keep an extra reference, call the methods and release it.
2016-09-02 00:08:49 -03:00
Jean-Philippe Andre ed9413c1c1 ecore_poller: Fix unlikely crash if eo data is null
This happened to me when running elm_suite manually.
2016-09-01 11:57:43 +09:00
Vitor Sousa f02ff462e7 efl callbacks: update some events calls to no longer trigger legacy callbacks 2016-08-30 13:59:59 -03:00
Tom Hacohen d5e321466e Efl object: Rename Eo_Event -> Efl_Event.
This is the last step of the Eo renaming efforts.
2016-08-30 13:34:10 +01:00
Vitor Sousa 8356b16a49 Efl Object: remove legacy callback calls from event_callback_call
Efl.Object.event_callback_call no longer calls legacy smart callbacks;
calling only event callbacks registered with the given event description
pointer.

Create the method Efl.Object.event_callback_legacy_call to inherit the old
behavior from Efl.Object.event_callback_call, calling both Efl.Object events
and legacy smart callbacks.

Update all other files accordingly in order to still supply legacy
callbacks while they are necessary.
2016-08-26 15:45:07 -03:00
Gustavo Sverzut Barbieri 5d4688679e efl.io: introduce basic interfaces and classes.
These interfaces allows generic operations on objects that can store
or provide data, such as a file or a buffer.

With well defined interfaces and events we can create code such as
Efl.Io.Copier, that will link a source with a destination and
progressively copy data as they appear.
2016-08-22 18:25:14 -03:00
Gustavo Sverzut Barbieri c88b027dc1 efl_loop_user: error if parent is not a loop provider.
it was silently ignoring the parent, which led me to hours trying to
investigate why my code wasn't working just to realize my parent
wasn't being assigned and refcounts were screwed.
2016-08-18 02:13:32 -03:00
Jean-Philippe Andre 87d1b3f7c4 elm: Hide new init APIs behind BETA tag
This places the following behind beta:
- efl_quicklaunch_fallback
- efl_build_version_set

I don't think EFL_MAIN would have worked without BETA API support,
so no need to expose those for now.

@fix
2016-08-16 17:33:05 +09:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Cedric Bail 7e8c6b212d ecore: properly track events in Efl.Loop.Fd object.
Thanks Gustavo.
2016-08-05 12:14:18 -07:00
Tom Hacohen bf772125e8 Eo: Move Eo back into beta.
Eo should now be considered beta again. This commit puts it back in beta
and makes it necessary to define EFL_BETA_API_SUPPORT before including
Eo.h.
2016-08-02 16:34:35 +01:00