summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_promise.c (unfollow)
AgeCommit message (Collapse)Author
2021-04-10eina_promise: do not self feedback when cancelingMarcel Hollerbach
when canceling a all_promise it will cancel all futures. When that happens, and one future is containing a promise, the value is unrolled, and delivered as "Operation canceled" if this is happening to the last future in all or any in race, the promise will then free its base ctx which is already happening due to canceling. With this this is not happening anymore.
2021-02-25eina_promise: Fix unchecked return valueChristopher Michael
Small patch to check return value of eina_value_get reported by Coverity Fixes CID1400993
2020-11-25eina: Rename EAPI macro to EINA_API in Eina libraryFelipe Magno de Almeida
Summary: Patch from a series of patches to rename EAPI symbols to specific library DSOs. EAPI was designed to be able to pass `__attribute__ ((visibility ("default")))` for symbols with GCC, which would mean that even if -fvisibility=hidden was used when compiling the library, the needed symbols would get exported. MSVC __almost__ works like GCC (or mingw) in which you can declare everything as export and it will just work (slower, but it will work). But there's a caveat: global variables will not work the same way for MSVC, but works for mingw and GCC. For global variables (as opposed to functions), MSVC requires correct DSO visibility for MSVC: instead of declaring a symbol as export for everything, you need to declare it as import when importing from another DSO and export when defining it locally. With current EAPI definitions, we get the following example working in mingw and MSVC (observe it doesn't define any global variables as exported symbols). Example 1: dll1: ``` EAPI void foo(void); EAPI void bar() { foo(); } ``` dll2: ``` EAPI void foo() { printf ("foo\n"); } ``` This works fine with API defined as __declspec(dllexport) in both cases and for gcc defining as `__atttribute__((visibility("default")))` However, the following: Example 2: dll1: ``` EAPI extern int foo; EAPI void foobar(void); EAPI void bar() { foo = 5; foobar(); } ``` dll2: ``` EAPI int foo = 0; EAPI void foobar() { printf ("foo %d\n", foo); } ``` This will work on mingw but will not work for MSVC. And that's why EAPI is the only solution that worked for MSVC. Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com> Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev> Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com> Reviewers: jptiz, lucas, woohyun, vtorri, raster Reviewed By: jptiz, lucas, vtorri Subscribers: ProhtMeyhet, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12188
2020-05-07Use __func__ C99 identifier instead of __FUNCTION__ compiler extensionVincent Torri
Summary: see http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf section 6.4.2.2 page 52 Test Plan: compilation Reviewers: raster, devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11785
2020-03-17doxygen docs: Fix Eina Promises doc structure and linksXavi Artigas
Man, this was a tough one! The content still needs work, but the structure makes a bit more sense now, and there are no broken links, typos or doxygen warnings anymore.
2020-02-12eina - promise - be safe if no scheduled_entry is thereCarsten Haitzler (Rasterman)
something is causing a scheduled entry to be called with no scheduled entry: https://phab.enlightenment.org/T8490 - valgrind trace aattached. i can't see it so i don't know what. the only protection i can put in is this.
2020-01-31eina: add eina_future_all_iterator and eina_promise_all_iterator.Cedric BAIL
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11180
2019-05-09eina: always initialize all the field of Eina_Value used by Eina_Promise.Cedric BAIL
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D8794
2019-03-27eina: prevent double cancel of ongoing dispatched future.Cedric BAIL
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D8333
2019-03-26eina: always initialize i.Cedric BAIL
Reviewers: zmike, bu5hm4n, stefan_schmidt, devilhorns Reviewed By: devilhorns Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8451
2019-01-23eina: fix memory leak when a Eina_Value as promise is returned, but no ↵Cedric BAIL
dispatching Eina_Future is listening on it. Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7652
2019-01-16eina: remove eina_promise_data_get has it lead to risky use.Cedric BAIL
It seems that use of eina_promise_data_get lead to mostly missuse. As it duplicate other infrastructure which do not have the same problem. So better remove it and if we need it back, we can just revert this patch later. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7578
2019-01-16eina: remove eina_promise_data_set.Cedric BAIL
eina_promise_data_set is a misleading API and result in conflicted use by multiple independent piece of code leading to bug and crash. It is also not necessary and we can avoid using it completely. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7575
2019-01-16Revert "eina: add a function to free Eina_Promise attached data when the ↵Cedric BAIL
promise is destroyed." A better solution is to actually have no eina_promise_data_set/get at all. This reverts commit ce56f32270c2f75adab022b701d3bdcbbbc3fb44. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7574
2019-01-16Revert "fix crashes created by "make efl_loop_promise_new a function""Cedric BAIL
This serie of patch didn't address the core problem in the design of the ownership of eina_promise_data_{set/get} usage. It is also redundant with other infrastructure in eina_promise and so not necessary completely. This reverts commit de2ec0559b01dba7919503955cc47c1c5fcd0f97. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7573
2018-12-26fix crashes created by "make efl_loop_promise_new a function"Carsten Haitzler (Rasterman)
commit 9b5155c9f135f9ef450a817979f5884352b2d4c0 brought about crashes - specifically that i saw in terminology because it actually uses eina_promise_data_set() and the new efl_loop_promise_new basically took over ownership of that data, but if anyone used eina_promise_data_set() the data ptr used by this new code would bwe overwritten, causing segfauls when terminology loses selection ownership. for days i had mysterious crashes of terminology until i narrowed it down to the above, so if you have too, then this will fix it. what this does is create a data set intercept function callback that for now is only for use inside efl to everride data sets so they set data inside the new struct that tracks data. i also had to add and intercept for eina_promise_data_free_cb_set() as this in theory could also ber a similar problem. so perhaps the idea/design of efl_loop_promise_new() is not right and this kind of thgn has to be internal to eina promise... this means eina promise and loops are much more tied together.
2018-12-20eina: add a function to free Eina_Promise attached data when the promise is ↵Cedric BAIL
destroyed. Reviewed-by: Lauro Neto <Lauro Moura <lauromoura@expertisesolutions.com.br>> Differential Revision: https://phab.enlightenment.org/D7491
2018-12-20eina: use the correct type for casting to avoid issue on Windows.Cedric BAIL
Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Differential Revision: https://phab.enlightenment.org/D7458
2018-11-09xxx - fix eina_future_then calls to pass sotrage val - fix warnsCarsten Haitzler (Rasterman)
2018-11-09eina promise - warning fix - init storage field on returnCarsten Haitzler (Rasterman)
fix a warning but this actually is a bug with storage being left uninitialized.
2018-05-07eina: actually it make more sense to do the check for EINA_VALUE_EMPTY ↵Cedric BAIL
inside eina_value_type_get.
2018-05-07eina: allow EINA_VALUE_EMPTY for Eina_Future as Eina_Value.Cedric BAIL
2018-05-05eina: Eina_Future as Eina_Value can also be cancelled.Cedric BAIL
2018-05-01eina: allow EINA_VALUE_EMPTY to be propagated with eina_future_as_value.Cedric Bail
2018-03-12eina: fix promise scheduler lookup to find it when given a resolved chain of ↵Cedric BAIL
future. T6738
2018-03-03ecore - a different take on efl.app class as a super class to efl.loopCarsten Haitzler (Rasterman)
so the MAIN loop is actually an efl.app object. which inherits from efl.loop. the idea is that other loops in threads will not be efl.app objects. thread on the creator side return an efl.thread object. inside the thread, like the mainloop, there is now an efl.appthread object that is for all non-main-loop threads. every thread (main loop or child) when it spawns a thread is the parent. there are i/o pipes from parnet to child and back. so parents are generally expected to, if they want to talk to child thread, so use the efl.io interfaces on efl.thread, and the main loop's elf.app class allows you to talk to stdio back to the parent process like the efl.appthread does the same using the efl.io interfaces to talk to its parent app or appthread. it's symmetrical no tests here - sure. i have been holding off on tests until things settle. that's why i haven't done them yet. those will come back in a subsequent commit for really quick examples on using this see: https://phab.enlightenment.org/F2983118 https://phab.enlightenment.org/F2983142 they are just my test code for this. Please see this design document: https://phab.enlightenment.org/w/efl-loops-threads/
2018-01-10eina: add eina_promise_continue_new to create a promise using an existing ↵Cedric Bail
dead future.
2017-12-28remove elgacy ecore event usage in futures that limit to mainloop onlyCarsten Haitzler (Rasterman)
also eina_procmis was not threadsafe so cannto use loops in different threads at all until this was made safe. needed to disable the old ecore_event using code in for ecore futures and create a new efl loop message future and handler instead ... but now a quick experiment with multiple loops in 10 threads plus mainloop have timers at least work. i need to test more like fd handlers etc etc. but it's a step.
2017-12-18eina: make __eina_promise_cancel_all an internal only function.Cedric BAIL
2017-12-18eo/eina: Add HACK to avoid calls to EO after shutdownJean-Philippe Andre
Efl.Future is an EO object which means even cancelling Efl.Future objects requires EO. So this should be done before shutting down EO, otherwise everything fails badly. I believe Efl.Future is going to disappear soon, but the problem will remain: if any promise/future uses EO or anything else outside of Eina (so, basically anything) then it needs to be canceled before shutting down the above layers. This is the same situation as with ecore events, for which we've introduced ecore_event_type_flush. Ping @cedric
2017-10-25eina: add helper to return already known to fail future.Cedric BAIL
2017-09-11eina: add eina_promise_data_set symetric to eina_promise_data_get.Cedric BAIL
2017-09-05eina_promise: remove shadowed declaration warningThiep Ha
2017-09-04Eina_Future: add eina_future_resolved()Gustavo Sverzut Barbieri
This is a helper that creates a promise, then a future and immediately resolves the promise, this will let the future be dispatched as usual, from a clean main loop context.
2017-09-04Eina: Add Eina_Promise/Eina_Future.Guilherme Iscaro
This commit adds a new promise/future API which aims to replace efl_future.
2016-11-07eina: remove Eina_Promise.Cedric BAIL
2016-07-29eina: promise: fix memory leak in error pathStefan Schmidt
If we would not get a promise back here the allocated array would leak when we return. Make sure we also free it in this case. CID: 1360468
2016-07-21eina: Fix null pointer derefernceChris Michael
Coverity reports that eina_safepointer_get returns a NULL promise here (checked 20 out of 21 times). As eina_safepointer_get can return NULL, we should check the validity of 'promise' here before trying to derefernce it later. Fixes Coverity CID1356625 @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-06-14eina: Fix race wrong prototype for unrefFelipe Magno de Almeida
2016-06-11eina: Add support for eina_safepointer in promisesFelipe Magno de Almeida
2016-06-09eina: Smudge magic value on promise deletionLauro Moura
2016-06-09eina: Remove value type promisesLauro Moura
All values in promises are now considered as by-pointer.
2016-06-09eina: Fixes on promises behavior when cancellingLauro Moura
- Free the cancel callbacks on promise delete - Cancelling an ended promise should be a nop - More tests to increase coverage
2016-06-06eina: eina_promise_all callback cast removedLarry Jr
2016-06-06eina: Avoid promise early deletion when cancelled.Lauro Moura
Cancelling a promise will fulfill it but won't actually free the memory. This memory is under custody of the owner, who must either call value_set or error_set to finish it.
2016-06-05eina: Fix promise tests and avoid early deletionLauro Moura
- Progress notify refcount fixes, avoiding early deletion - Avoid leaking memory on tests
2016-06-05Eina promise: Fix broken return value.Tom Hacohen
I broke it in dc73f6644e0ed8fdbd2c6c8187591fb7eb8027c7. Excuse of the day: I'm not working from my usual spot and there's screen glare here that made me not see the *. Good excuse?
2016-06-05Eina promise: Simplify code and remove shadow variable.Tom Hacohen
There was no need for the extra variable. This also fixes a shadow warning.
2016-06-03eina: Fix magic check for eina_promise_owner_buffer_getFelipe Magno de Almeida
2016-06-03eina: Fix EINA_MAGIC and eina_promise_then NULL checkFelipe Magno de Almeida