Commit Graph

680 Commits

Author SHA1 Message Date
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
Cedric BAIL dd1d3f0d2d autotools: since it has been broken for some times and nobody noticed, let's remove per directory support. 2016-08-01 13:36:47 -07:00
Carsten Haitzler 04c6313114 ecore - add more ecore main loop checks that were missing in some places
so 1 ecore_exe func was missing a main loop check... just to be sure.
2016-07-14 08:55:03 +09:00
Cedric BAIL fd5d31696d ecore: early destruction of animator allow for tick end to always be triggered.
T4043
2016-07-13 15:32:15 -07:00
Ivan Furs 4387f34b54 [Bug] EFL memory leak on Windows(handler continuously increasing)
Summary:
Fix: event need to clese  when create event:
  event = WSACreateEvent();

Reviewers: bowonryu, herb, Jaehyun, thiepha, Hermet, jaehwan, cedric, raster

Reviewed By: raster

Subscribers: NikaWhite, reutskiy.v.v, artem.popov

Differential Revision: https://phab.enlightenment.org/D4157
2016-07-13 21:01:50 +09:00
Carsten Haitzler 2d003e2503 ecore pipe - fix close of pipe that doesnt set fd to invalid
this should fix CID 1267459
2016-07-11 22:02:45 +09:00
Carsten Haitzler f6d8ae3123 ecore animator - remove dead code
fix CID 1356618
2016-07-09 12:09:41 +09:00
Jean-Philippe Andre b32a8d3a0f ecore: Fix warning about err_no
Double warning, yay:
 explicitly assigning value of variable of type 'int' to itself
 variable 'err_no' is uninitialized when used here

See 1abbfdd1f7
2016-07-08 12:27:29 +09:00
Carsten Haitzler 1abbfdd1f7 ecore - be paranoid about storing errno from select immediately
in theory another libc call could overwrite errno between select
exiting and errno being used for errors. be paranoid. i know of no
real bug that this causes though.
2016-07-08 11:00:55 +09:00
Cedric BAIL cdf04241db ecore: on first arguments event notify the needs to initialize the process state. 2016-07-06 15:51:25 -07:00
Carsten Haitzler 9527240d74 efl - fix lots of little init/shutdown pairs that are wrong
i've fixed almost all the eina init/shutdown pairs to do the right
thing now... except one (ecore_shutdown) with comment inline where
eo_shutdown is not called. if this is called we are in crash land.
this needs further inspection.
2016-07-04 21:30:34 +09:00
Jean-Philippe Andre 3671dd64c6 ecore: Fix obvious crash with legacy timers
ecore_timer_del() checks a flag "inside_call" that can be
set before calling the timer cb... but it was never reset
to 0. So, all legacy timers would keep on ticking forever
and ever, until they return CANCEL.

Anyway, I find the distinction between eo_del and
ecore_timer_del very troubling. eo_del() should work
on a legacy timer. Ping @cedric. Maybe override eo_del()?

Fixes T3898
2016-07-04 15:15:48 +09:00
Jean-Philippe Andre 45cd0465a4 efl: Add Efl.Version struct and APIs
The original idea behind knowing the app's version of EFL is not
a great story. It comes from the fact that some bugs exist in
earlier versions of EFL, and some things need to be fixed. But
those fixes may break behaviour for older apps. This patch is
opening the way to the slippery slope of bug compatibility.

Unfortunately this is a requirement if we want to be able to move
forward and not break apps when we fix bugs (behaviour or ABI).

I hope we will not need to implement too many (if any) workaround
such issues. For now, this will only be used as debugging info.

EFL_MAIN() and ELM_MAIN() will both set the app's EFL version
automatically at startup time. Some internal helpers can be added
later to check how the app build-time and run-time version of
EFL differ.

@feature
2016-06-29 15:01:34 +09:00
Jean-Philippe Andre a73e51136f loop: Add main class property to return the main loop
Note: this is both @class and @property. Hope that's ok for
all bindings.

This returns same as ecore_main_loop_get() (which now uses the eo
api instead).

Ping @cedric (so he can check this patch).
2016-06-29 11:17:44 +09:00
Jean-Philippe Andre 4d6216c7f6 ecore: Replace TABs with spaces 2016-06-27 17:29:06 +09:00
Cedric BAIL f441859bfb ecore: add the possibility to return an exit code when leaving the main loop. 2016-06-24 16:44:59 -07:00
Cedric BAIL c512bb68e7 ecore: fix Windows build by properly defining EAPI in all case for internal API user. 2016-06-23 10:53:46 -07:00
Cedric BAIL 068f57a79d ecore: fix arguments to use Eo native array type. 2016-06-22 14:36:39 -07:00
Cedric BAIL ec77773aa3 ecore: add ability for the main loop to provide other class of object. 2016-06-22 10:17:06 -07:00
Jean-Philippe Andre e68e8d0088 ecore: Fix _ecore_animator_shutdown (double free)
evas 3d examples would always exit on a double free, since
EINA_INLIST_FREE was misused. Not surprising considering
it's different from EINA_LIST_FREE but has a similar name.
2016-06-21 10:14:13 +09:00
Tom Hacohen 6202cc7485 Adjust the code according to the eo event stop changes.
This was changed in the previous commit.
2016-06-20 18:02:00 +01:00
Cedric Bail 70aa45829a ecore: prevent crash in case of double ecore_timer_del in legacy case. 2016-06-15 10:54:09 -07:00
Vincent Torri 8cccde76fe Ecore: detect ieeefp.h existence instead of including it with compiler's macro
On Solaris, this header is necessary for finite(). Instead of including it
if the sun compiler is used, include it if it exists. This fixes a warning
if gcc is used on Solaris
2016-06-14 18:50:00 +09:00
Felipe Magno de Almeida 949af55947 eina: Add support for eina_safepointer in promises 2016-06-11 10:40:27 -03:00
Lauro Moura 46843551c0 eina: Remove value type promises
All values in promises are now considered as by-pointer.
2016-06-09 22:38:54 -03:00
Cedric BAIL ef0df96da1 ecore: properly reset fd handler when parent get deleted. 2016-06-06 16:29:16 -07:00
Cedric BAIL d8d00bd228 ecore: migrate ecore_timer lifecycle to rely cleanly on Eo lifecycle. 2016-06-06 15:41:24 -07:00
Benjamin Jacobs d41b47f47e ecore_time.c: do not mess with the representation of clockid_t.
Clockid_t should be used as an opaque type. Some platform might want
to (and even do, e.g. DragonFlyBSD) declare clockid_t as an unsigned.

On such platform, testing the sign of clockid_t is never false, and
assigning it a negative value is an UB, which makes this code unlikely to
work as intended. Fixes black window on dragonfly!

Thanks to gcc for spotting this.

  CC       lib/ecore/lib_ecore_libecore_la-ecore_time.lo
  In file included from ../src/lib/eina/Eina.h:215:0,
                   from lib/ecore/Ecore.h:304,
                   from lib/ecore/ecore_time.c:18:
                   lib/ecore/ecore_time.c: In function 'ecore_time_get':

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-06-06 12:05:43 -07:00
Benjamin Jacobs b548a6396b ecore_signal.c: factoring out the platform test to improve readability.
Turns out there is no PRI?SIGATOMIC in the C99 standard. Work around
that by deducing the effective integer type by comparing the
SIG_ATOMIC_MAX with integers *MAX.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-06-06 12:05:43 -07:00
Lauro Moura 217f3ce842 ecore: Fix ecore thread promises
Make sure we free the promise memory, set MAGIC numbers and avoid
leaking the underlying eina promise
2016-06-05 21:59:35 -03:00
Cedric BAIL 58c477a30a ecore: properly handle double free case of timeout promise.
The bug came from the fact we need to handle the destruction of the
main loop which destroy the underlying timer. The event handler that
catch the destruction of the timer can not make the difference between
eo_del call from the timeout code and eo_del from the main loop
destruction. By removing the event handler, the double free is properly
avoided.
2016-06-03 17:00:12 -07:00
Cedric BAIL 0e6d5df60c ecore: use EINA_ERROR_PROMISE_CANCEL instead of a custom Ecore one. 2016-06-03 17:00:12 -07:00
Cedric BAIL 10ee8bc844 ecore: do not generate error while rescheduling the last timer. 2016-06-03 17:00:12 -07:00
Cedric BAIL 2b12aea5e6 ecore: Ecore_Cb is used by elm_box.eo. 2016-06-03 17:00:12 -07:00
Cedric BAIL b3d56820d5 ecore: Efl.Timer should be Efl.Loop.Timer for coherence.
As we add more object in the main loop, they can't live in the top
namespace as they make little sense there (Efl.Fd !). For coherence,
everyone should in the loop namespace, so move timer there.
2016-06-03 17:00:12 -07:00
Cedric BAIL 5cc16b1c29 ecore: remove Ecore_Animator Eo object.
This is only a legacy API.
2016-06-03 17:00:12 -07:00
Derek Foreman 6c2a3a2034 ecore_anim: Fix bad assumption about signedness of chars
Whether "char" is signed or unsigned is architecture dependent, so if we
know we need a -1 in a char type we must declared it to be signed.
2016-06-03 16:28:24 -05:00
Felipe Magno de Almeida e79eb53e8d eina: Remove Eina_Promise* parameter in promise callback
Remove not very useful parameter to eina_promise_then callbacks.
2016-06-03 18:15:57 -03:00
Felipe Magno de Almeida 8fec0d5139 eina: Remove unnecessary indirection to promises
Now when dealing with pointer types, we will not get pointer to
pointer semantics in callbacks and eina_promise_owner_value_set
for Eina_Promise.

It will work as expected:

Eina_Promise_Owner* promise = eina_promise_add();

void* p = malloc(sizeof(T));
eina_promise_owner_value_set(promise, p, &free);
2016-06-03 17:22:12 -03:00
Carsten Haitzler f3b6d34a0f ecore timeouts - dont crash on cancel
this fixes a nasty double deletion on cancel of timeouts. at least for
now as long as we have promises.
2016-06-03 18:09:35 +09:00
Daniel Kolesa b1946ca5d6 eolian: utilize the new void_ptr builtin across eo files
This lets me narrow down the remaining cases of pointers across the EFL.
The void pointers will later need to be reevaluated on per-case basis and
replaced appropriately where possible/feasible.
2016-06-02 13:00:26 +01:00
Carsten Haitzler 23f6bb33ee ecore loop args - go back to eo_del not eo_unref. 2016-06-01 22:11:02 +09:00
Tom Hacohen a6a2338962 Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba.

It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.

We would have an issue with references and objects being freed too soon
and in general, issue with the references.

Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.

eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 13:33:21 +01:00
Cedric BAIL 6bf9cd6ecc ecore: if you don't use the value, then don't set it. 2016-05-31 14:59:26 -07:00
Jean Guyomarc'h bc0547a705 ecore: remove unwanted debug messages
Da is making my console output ugly.
2016-05-31 21:47:48 +02:00
Daniel Kolesa 6fc482aa9b eolian: utilize the new builtin string type across eo files 2016-05-31 16:05:43 +01:00
Jean-Philippe Andre 5aa00004a5 ecore_evas: Register direct input cb from modules
If the ecore_evas modules were using
ecore_event_window_register() then they can also redirect
everything though the direct callback instead.
2016-05-31 19:03:04 +09:00
Carsten Haitzler f0335bde28 efl loop - add an args event and ability to produce it
this is an args event. right now we don't use it, but this should be
done by some of the setup/init of an app and then produce an args
event. the idea would be that this can be used by single-instance apps
like web browsers, terminology to treat launch as an event.
2016-05-30 19:47:21 +09:00
Felipe Magno de Almeida de9be13d45 eina: Add promise parameter to then calllbacks
Added promise parameter to then callbacks so callbacks can steal
ownership of the value from the promise.
2016-05-25 21:32:03 -03:00
Daniel Kolesa e984e5a11a eolian: remove pointers from complex and class types
Complex types (i.e. list, array, hash, accessor etc.) now do not require
pointers with them anymore (the pointer is implied) and the same goes for
class handles. Eolian now explicitly disallows creating pointers to these
as well. This is the first part of the work to remove pointers from Eolian
completely, with the goal of simplifying the DSL (higher level) and therefore
making it easier for bindings (as well as easier API usage).

@feature
2016-05-23 15:58:33 +01:00
Cedric Bail 4f43c27450 ecore: promise for timeout and job are clearly never optional, so return them. 2016-05-20 02:25:48 -07:00
Cedric Bail 75a53ece10 eo: for consistency use object like all our API. 2016-05-18 08:18:04 -07:00
Daniel Kolesa 7782c0bcb9 eolian: add event_prefix and have classes follow that or eo_prefix by default
Previously events used to use class name as a prefix and ignored eo_prefix
when specified. This is no longer the case. Events follow eo_prefix by default
now. In order to get around this for classes where this is undesirable, a new
field event_prefix was added which takes priority over eo_prefix. If neither
is specified, class name is used like previously.

@feature
2016-05-17 17:50:43 +01:00
Tom Hacohen 546ff7bbba Eo: Remove eo_del() and make eo_unref() the replacement.
We used to have eo_del() as the mirrored action to eo_add(). No longer,
now you just always eo_unref() to delete an object. This change makes it
so the reference of the parent is shared with the reference the
programmer has. So eo_parent_set(obj, NULL) can free an object, and so
does eo_unref() (even if there is a parent).

This means Eo no longer complains if you have a parent during deletion.
2016-05-17 16:23:23 +01:00
Cedric Bail aa4da11b33 ecore: do not create another main loop object
So ecore main loop does restart everything with an main loop shutdown
and init when it detect a bad fd. This can happen if you del a fd after
you have destroyed it. Something terminology is doing (and should be
legal), but that then ended up with a main loop with no event handler
registered and the process was looking like stuck with nothing happening.
2016-05-17 07:41:13 -07:00
Tom Hacohen 6bdf4af016 Add legacy_prefix now that the default has changed to null. 2016-05-12 17:27:35 +01:00
Tom Hacohen 96c4c88070 Efl: Remove "legacy_prefix: null;" as it's now the default. 2016-05-12 17:27:35 +01:00
Tom Hacohen 3d6238c044 Ecore exe: Fix namespacing to use . and not _. 2016-05-12 12:20:34 +01:00
Cedric BAIL 0c4880e99d efl: everyone should now rely on Eina MIN/MAX redefinition. 2016-05-09 16:58:53 -07:00
Felipe Magno de Almeida 6d43adaaf4 eina: Fix memory leaks in promise 2016-05-07 13:55:18 -03:00
Cedric BAIL c96383e42c ecore: add Efl.Loop.Fd.
This allow you to monitor fd and get notification using Eo events. I
have not implemented the buffered read as used by X. I think that if
this is useful, we should just do another class to handle bufferred fd.
2016-05-06 15:35:36 -07:00
Cedric BAIL 45d17f100e ecore: update documentation of Efl.Timer.
I am wondering how this is going to affect our legacy API documentation
which has indeed a different lifecycle.
2016-05-06 15:35:36 -07:00
Jean Guyomarc'h 334d32a575 ecore: don't use an unspecified amount of arguments 2016-05-06 22:18:57 +02:00
Jean Guyomarc'h 279203c016 ecore/getopt: slightly improve documentation 2016-05-06 22:18:57 +02:00
Jean Guyomarc'h 198326fbd2 ecore: fix typo in documentation of Ecore_Exe_Event_Del 2016-05-06 22:18:57 +02:00
Cedric Bail c7d652ade1 ecore: fix legacy use of double free scenario. 2016-05-05 21:55:43 -07:00
Cedric Bail bfc19893d7 Revert "ecore timer - fuix up segv storm that has crept in with frees"
This reverts commit a13570c17c.

This doesn't really fix the problem which is hidden by eo capability to not
crash on bad unref. With legacy API you are allowed to do a ecore_timer_del
and also return EINA_FALSE. In that case you have a double eo_del (which is
luckily protected) and a double free (that is not). It does crash on the
double free, but the issue is a lifecycle issue. Will bring a better patch
for this.
2016-05-05 21:40:23 -07:00
Carsten Haitzler a13570c17c ecore timer - fuix up segv storm that has crept in with frees
freeing already freed data, not clearing up pointers to freed data
once freed etc. etc. etc. - segv land. fix that up so we can use efl
again. :(
2016-05-06 11:06:56 +09:00
Cedric BAIL 43a4411f43 ecore: make efl.timer depend on efl.loop_user. 2016-05-05 17:03:07 -07:00
Cedric BAIL 05424556b0 ecore: add an efl.loop_user class. 2016-05-05 17:03:07 -07:00
Cedric BAIL 8d50990a27 ecore: add a timeout promise. 2016-05-04 15:42:59 -07:00
Cedric BAIL 3ba901f15e ecore: rework efl_timer to be a proper eo object emiting signal. 2016-05-04 15:42:59 -07:00
Cedric BAIL 639378bfc7 ecore: remove timer dump logic as Eo and clouseau should give us that info. 2016-05-04 10:30:13 -07:00
Cedric BAIL 1adf08e41c ecore: fix split built. 2016-05-04 10:30:13 -07:00
Cedric BAIL 93af61f255 ecore: rename ecore_timer to efl_timer. 2016-05-04 10:30:13 -07:00
Marcel Hollerbach c66695bedb eo: replace loop_get with object_find
Summary:
object_find is more generic, so other mechanisms can also reuse the
code.
The object itself has to support the function, so there is no need for
eo_isa which would have a negative performance impact.
The base class implementation calls interface_get on the parent, so a
override of the function can just call the super function to continue in
the recursion.

Test Plan: just run the eo test suite

Reviewers: raster, tasn, jpeg

Reviewed By: tasn, jpeg

Subscribers: felipealmeida, netstar, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3909
2016-05-04 10:43:55 +02:00
Cedric BAIL ba10fa6636 ecore: silent warnings by directly freeing. 2016-05-03 14:32:05 -07:00
Cedric BAIL c1141c7b0b ecore: remove dead Ecore_Job eo object. 2016-05-03 13:31:43 -07:00
Cedric Bail 7fa953e9ae ecore: add Efl.Loop.Job promise. 2016-05-02 18:17:09 -07:00
Cedric Bail 3b68135baf ecore: forgot to handle recursive destruction in a function that actually ask for destruction. 2016-04-21 22:37:45 -07:00
Carsten Haitzler 0d0ba19e51 efl loop: implement loop.get property to return self
this means that on loop_get on any obj as long as its a child of a
loop obj... it'll retunr that loop now. it will work. no more code
needed.

we can shortcut this with ui/gfx objects returning the mainloop
singletone.
2016-04-22 09:38:58 +09:00
Cedric BAIL 454722cf6f ecore: rename Ecore_Mainloop to Efl.Loop. 2016-04-21 15:11:32 -07:00
Cedric BAIL 9efefb1f2e ecore: ecore_main_loop_animator_ticked_get seems to be useful only for Ecore_Evas. 2016-04-21 14:54:02 -07:00
Cedric BAIL 869a2243e7 ecore: ecore_main_loop_select_func_set is definitively an internal function. 2016-04-21 14:50:19 -07:00
Cedric BAIL 3108f023ba ecore: move ecore idle exiter to relly on the factorized main loop event. 2016-04-21 14:49:00 -07:00
Cedric BAIL e87e501230 ecore: remove useless define 2016-04-21 14:49:00 -07:00
Cedric BAIL 5c87f2762f ecore: use new refactorized idle infrastructure to make idle enterer rely on mainloop events 2016-04-21 14:07:49 -07:00
Cedric BAIL 7c62154d52 ecore: allow for possible factorization of all idler event. 2016-04-21 14:07:49 -07:00
Cedric BAIL 3ff21c021d ecore: move Ecore_Idler to legacy and rely on Eo event restart capability. 2016-04-21 12:07:50 -07:00
Cedric BAIL 559d4e8b68 ecore: give the mainloop its own private data. 2016-04-21 12:07:50 -07:00
Cedric BAIL bc7174262f ecore: make the main loop singleton initialized and available early on. 2016-04-21 12:07:50 -07:00
Cedric BAIL 54126d8fa5 ecore: use restartable event for main loop event. 2016-04-20 15:54:18 -07:00
Tom Hacohen 5bec0d07b4 Ecore eo: Resolve duplicate Ecore_Cb definition. 2016-04-20 10:11:21 +01:00
Carsten Haitzler 84a4870d5b ecore exe: don't allocate inside fork to avoid issues with mem debuggers
so i've been doing some debugging and having a mem debugger that
preloads and tracks allocs means you need locks, but locks can do
nasty things after forks + threads.... esp if threads held locks.

this allows mem debugging with preloads easily and doesn't muck things
up.
2016-04-18 21:46:25 +09:00
Stefan Schmidt f012499f47 docs: document ecore_mainloop class, functions and events. 2016-04-17 17:42:41 +02:00
Stefan Schmidt e728ea168f docs: add description for ecore_poller class and cleanup some other parts 2016-04-17 17:42:40 +02:00
Stefan Schmidt 4f6cc20e84 docs: fix some typos in ecore_timer EO docs 2016-04-17 17:42:40 +02:00
Cedric BAIL 192a966e60 ecore: make it possible to build the library alone. 2016-04-14 16:07:32 -07:00
Stefan Schmidt 5a3af92e5b docs: add description for class and method parameters 2016-04-14 18:27:42 +02:00
Stefan Schmidt 3c93a3268c docs: add method parameter descriptions for ecore_idle_*
Now that we support these in docgen catch up in some example EO files.
2016-04-14 18:27:42 +02:00
Stefan Schmidt f9189fea78 docs: add class and method parameter descriptions to ecore_idler class 2016-04-14 18:27:42 +02:00