Commit Graph

711 Commits

Author SHA1 Message Date
Carsten Haitzler 25c63f726e eina thread - fix window build with sigprocmask
fixes T4048
2016-07-08 21:11:21 +09:00
Carsten Haitzler aeeda1f77d efl - threads and signals - make efl work on "insane" os's with signals
so. on linux signals are delivered to the main process thread/loop.
thats' where signal handlers are set up and always run. this is sane.
it's predicatble. but of course this is not the same in bsd land.
there "just send the signal to any old thread and call the signal
handler there" seems to tbe the order of the day. this explains why
wer are losing sigchld signals in edje_cc - it's heavily threaded and
bsd is just randombly picking a thread to call it on.

this fixes that. in theory. i hope. i can't test, but putting it in to
share

@fix
2016-07-04 23:47:25 +09:00
Jean Guyomarc'h e333175109 eina: fix typos in eina_rectangle doc 2016-06-26 18:48:15 +02:00
Jean Guyomarc'h 33bb4583b8 eina: fix compiling of safepointers on OSX
This is a reccurring compatibility issue...
MAP_ANONYMOUS is not defined on OSX, but MAP_ANON is.
I know MAP_ANON is marked as deprecated in the Linux man
pages, but it has the benefit of being more portable.
2016-06-15 22:33:39 +02:00
Carsten Haitzler fe9a9d8759 eina - alloca.h - include stdlib and stddef, usze size_t not long 2016-06-15 14:33:56 +09:00
Felipe Magno de Almeida f33b53e923 eina: Fix race wrong prototype for unref 2016-06-14 23:08:13 -03:00
Felipe Magno de Almeida 949af55947 eina: Add support for eina_safepointer in promises 2016-06-11 10:40:27 -03:00
Cedric BAIL 692b2c9fc9 eina: add generic infrastructure for a Eina_Safepointer
This is heavily inspired from Eo_Id infrastructure. Main change
are that the lower bit are always guaranteed to be zero and ignored
by all function. Also it may be a little bit less efficient in some
case, but we will tune it once we have real life usage of it.

Eo won't be migrated for 1.18 to it as Eo_Id is deeply integrated
and it is quite risky to touch it so close from a freeze. This can
wait.
2016-06-10 13:57:01 -07:00
Lauro Moura 2d2e57eccd eina: Smudge magic value on promise deletion 2016-06-09 22:39:25 -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
Lauro Moura 5a3331618e eolian: remove support for value-type promises 2016-06-09 19:14:18 -03:00
Lauro Moura 3b090b808b eina: Fixes on promises behavior when cancelling
- Free the cancel callbacks on promise delete
- Cancelling an ended promise should be a nop
- More tests to increase coverage
2016-06-09 19:14:14 -03:00
Jean Guyomarc'h dec1d251dc eina: ensure resource destruction on failure
In case of failure within eina_lock_new() (posix), a
pthread_mutexattr_t would have been left in an initialized state,
without any deinitialization being called.

Consequences would have been implementation defined.
2016-06-06 23:45:18 +02:00
Benjamin Jacobs 731e88061a eina_thread.c: fix include guard.
DragonFlyBSD has pthread_setname_np but no pthread_setaffinity_np;
we still need to include pthread_np though.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-06-06 12:05:43 -07:00
Larry Jr 2e441c3f5e eina: eina_promise_all callback cast removed 2016-06-06 03:30:42 -03:00
Lauro Moura 47dea6abc1 eina: Avoid promise early deletion when cancelled.
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-06 03:09:40 -03:00
Lauro Moura b28f6f2fce eina: Fix promise tests and avoid early deletion
- Progress notify refcount fixes, avoiding early deletion
- Avoid leaking memory on tests
2016-06-05 21:58:19 -03:00
Tom Hacohen 4c3b7fb248 Eina promise: Fix broken return value.
I broke it in dc73f6644e.
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-05 11:00:55 +01:00
Tom Hacohen dc73f6644e Eina promise: Simplify code and remove shadow variable.
There was no need for the extra variable. This also fixes a shadow
warning.
2016-06-05 10:57:07 +01:00
Felipe Magno de Almeida 1c269cf24a eina: Fix magic check for eina_promise_owner_buffer_get 2016-06-03 21:53:29 -03:00
Felipe Magno de Almeida 2e4765bc88 eina: Fix EINA_MAGIC and eina_promise_then NULL check 2016-06-03 21:43:57 -03:00
Cedric BAIL af2b0c8629 eina: protect promise death during callbacks cancel. 2016-06-03 17:00:12 -07:00
Felipe Magno de Almeida cd91b02dd1 eina: Add NULL checks and EINA_MAGIC checks to promises
Add NULL checks and EINA_MAGIC checks that avoid crashing when it
shouldn't.
2016-06-03 20:02:02 -03: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
Larry Jr 507bbdb054 Eina: Fix eina_promise_all refcount ordering problem
The call to eina_promise_then steals the first ref'count, so it is
possible that the promise is freed after the eina_promise_then,
so we need to eina_promise_ref before eina_promise_then.
2016-06-03 11:19:52 -03:00
Cedric BAIL 9bcad265a7 eina: don't access dead promise.
We do properly unref promise while calling all the then callback. There
is no need to check it a second time (which actually lead to a 100%
bad access).

T3759
2016-05-31 14:59:26 -07:00
Jean Guyomarc'h 092ce1f83b eina: fix warning when clockid is not defined
Unused parameter was unused...
2016-05-28 21:49:33 +02:00
Jean Guyomarc'h 9ee8ea196b eina: make eina backtrace portable
Backtrace relied on non-portable code.
Platform-specific code is now enclosed
within macros defined at configuration-time.
2016-05-28 19:18:46 +02:00
Felipe Magno de Almeida b0b8109cd5 eina: Make cancelled promises use EINA_ERROR_PROMISE_CANCELLED error code 2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida b7cdcff56a eina: Use pointer directly instead of by unnecessary indirection 2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida 2457d6f595 eina: Fix crashing when accessing past-the-end of the malloc'ed promise
The promise race composition was calculating its size wrongly, making
the promise's size smaller than it should, causing heap corruption.
2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida 3ffe38b0c3 eina: Fix then callbacks prototypes
Eina_Error is not passed by pointer anymore, which could cause invalid
pointer access in promise compositions (all and race).

Also added Eina_Promise* to prototypes.
2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida a7e5487439 eina: Add missing buffer_get function in Eina_Promise
Function buffer_get was available only in Eina_Promise_Owner, despite
being defined in both classes.
2016-05-26 13:35:07 -03:00
Carsten Haitzler 7ee4eba33f efl - new cmp "fix" code - remove one duplicated cmp 2016-05-26 12:49:58 +09:00
Carsten Haitzler 41842ca9f9 efl - fix many bounds over/underflow where we use int for ptr cmp
this addresses more things brought up in comments in

fixes T3638 commentd

@fix
2016-05-26 12:17:07 +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
Carsten Haitzler 636c8b48c7 eina hash - fix stringshare key comparison function
this fixes T3638

@fix

a note... thanks so much to aerodynamik for spotting this. i'm rather
surprised coverity didn't spot this... unless someone said to "shut up
coverity you're wrong" and they should not have.

i also might have expected compilers to spot this too... and add a
warning.

anyway ... this was a seriously subtle bug that could have caused all
kinds of havoc in efl.  keys that are different may be compared to be
the same. it could get ordering wrong and sorting thus maybe insert
keys that cannot be found anymore and oh so much more besides.
2016-05-26 09:28:23 +09:00
Carsten Haitzler 2c07846b7d eina vector - fix indenting and 80 col overflow in inline header 2016-05-21 23:37:07 +09:00
Carsten Haitzler 668e6091fb eina vector inline header - replace last equal with approx macro
rthis replaces double a == double b with a macro that keeps a close
enough range using epsilon (which is the error range for a dobule).

this fixes T3245
2016-05-21 23:36:38 +09:00
Carsten Haitzler f40a452ee1 fix warnings about double/float comparisons in eina vector
this should fix T3245

this is basicall where we go double a == double b and due to precision
issues this may not always be right, but this means that the
equivalent now checks for "really close values" rather than perfectly
exact.

@fix
2016-05-20 21:46:50 +09:00
Jean Guyomarc'h 147ef32b2b efl: fix misleading indentation
GCC's -Wmisleading-indentation is complaining...
It is a warning flag introduced in GCC 6.x, and
is enabled by -Wall.
2016-05-18 21:57:02 +02:00
Jean Guyomarc'h 64ce45b9b4 eina: add missing header guards 2016-05-18 21:56:58 +02:00
Cedric BAIL 0c4880e99d efl: everyone should now rely on Eina MIN/MAX redefinition. 2016-05-09 16:58:53 -07:00
Cedric BAIL d00643fcc4 eina: add MIN/MAX redefine as we use it everywhere.
This is done on an attempt to permanently fix our Windows port. Windows
doesn't have MIN/MAX, so we should always do a ifndef/define in every
piece of code that use it. Of course we always forget and it take times
to notice and fix. We have over the year added it in many private
headers, but as the issue continue to raise again and again, I prefer
to get this fixed in our main header.
2016-05-09 16:58:53 -07:00
Felipe Magno de Almeida 1c5ce16565 eina: Add eina_promise_race composition function
Added eina_promise_race function that composes multiple
promise objects into a new promise which is fulfilled
when one of the promises are fulfilled, or fails
when one of the promises have failed.
2016-05-09 19:10:26 -03:00
Felipe Magno de Almeida 6d43adaaf4 eina: Fix memory leaks in promise 2016-05-07 13:55:18 -03:00
Jean Guyomarc'h ccbe4579a3 eina: fix typos in tmpstr doc 2016-05-06 22:18:57 +02:00
Felipe Magno de Almeida 236c13df34 eina: Add progress notify callback feature for Promise Owners
Add a way for users of the promise owner to get notified when a
promise progress is registered. Also added a convenience composition
function that creates a promise which is fulfilled when another
promise has a progress notification.
2016-05-06 12:41:42 -03:00
Cedric BAIL 588b133c19 eina: make eina rectangle an allocated thread safe structure to use.
This is a better fix than D3913.
2016-04-25 12:48:08 -07:00