Commit Graph

26 Commits

Author SHA1 Message Date
Cedric Bail ab1080bdd3 ecore: allow other thread to write local data on a thread to increase utility. 2017-09-28 18:31:34 -07:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05:00
Umesh Tanwar b313b30cf7 ecore: proper macro usage for double comparision. Summary: The comparisions are done between doubles. EINA_FLT_EQ -> EINA_DBL_EQ
Summary: Signed-off-by: Umesh Tanwar <umesh.tanwar@samsung.com>

Reviewers: singh.amitesh, cedric

Subscribers: jpeg, atulfokk

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-03-21 11:11:23 -07:00
Marcel Hollerbach 097f9cfe5f ecore_thread: do not override the data field of a thread
otherwise a currently executed ecore_thread is going to pass a complete
wrong data to its callbacks.

fix T5175
fix T5173
2017-03-02 20:13:58 +01: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
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 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
Cedric BAIL 667b4340b9 ecore: remove floating point comparison warning from Ecore_Thread code. 2016-12-19 16:33:46 -08: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
Cedric BAIL 6c514dddb3 ecore: add a prototype ecore_thread helper with Efl_Promise/Efl_Future coupled. 2016-09-26 16:35:52 -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
Shinwoo Kim 163b50d0f1 ecore: thread - need to null check of function pointer
Summary: you can meet a segmentation fault without this patch

Test Plan:
please use the following snippet
   Ecore_Thread  *th;
   th = ecore_thread_feedback_run(_heavy_cb, _notify_cb, NULL, NULL, obj, EINA_TRUE);
   ecore_thread_wait(th, 1.0);

Reviewers: raster, Hermet, jaehwan, woohyun, cedric

Reviewed By: cedric

Subscribers: seoz

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-10 14:10:02 -08:00
Cedric BAIL c4117cdae4 ecore: fix usage eina_condition_timedwait to use relative time instead of absolute time.
This could lead to some very long and unexpected pause as the timeout passed
to eina_condition_timedwait was passed as a absolute time instead of relative.
Hopefully we don't build rocket.
2015-10-14 11:03:21 -07:00
Carsten Haitzler 5b2baf173e efl - set thread names for internally created threads for debugging
@feature
2015-09-10 15:17:08 +09:00
Jérémy Zurcher cb670931d6 ecore: fix compilation, missing return value in ecore_thread_wait
@fix ecore_thread_wait return EINA_TRUE if execution is over or thread is NULL
2015-01-07 22:12:29 +01:00
Cedric BAIL e5ddfb4b2b ecore: add ecore_thread_wait and necessary infrastructure.
This enable the possibility to block the main loop until a
specific thread is done. It may trigger still process ending
of other thread during that function call, but not any other
type of event (timer, animator, idler, ... are all ignored).
2015-01-07 16:45:07 +01:00
Carsten Haitzler ddc09dd04e fix ecore_thread_global_data_wait to work when no data exists yet
@fix

this is based on feedback from wonil choi, where this didn't work
right. this also has an if check for the hash itself.
2014-05-15 21:23:51 +09:00
Cedric Bail 7caef271dc ecore: Use Eina_Spinlock for Ecore_Thread. 2013-10-11 11:08:17 +09:00
Mariusz Grzegorczyk ec67ea9c1e ecore: fix segfault while adding new local or global data to thread. 2013-09-03 12:44:27 +09:00
Chris Michael 18a9719003 Fix memleak of Ecore_Thread_Data reported by Coverity
NB: Fixes Coverity CID1039280

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-07-08 12:54:42 +01:00
Cedric Bail 8dedcfae2c Fix warnings 2013-03-11 10:34:47 +09:00
Lucas De Marchi db395ef7eb efl: Remove check for unistd.h
* unistd.h: is very useful, very old and very standard.



SVN revision: 82577
2013-01-10 20:25:26 +00:00
Gustavo Sverzut Barbieri 4668d04f04 efl: cleanup HAVE_THREADS and pthread usage outside of eina.
Eina now abstracts threads, so use that.

the touched files had the EFL_HAVE_THREADS as it's mandatory now.



SVN revision: 81935
2012-12-31 16:14:40 +00:00
Vincent Torri 7d6010b12c merge: add escape ecore, fix several bugs
SVN revision: 79995
2012-12-02 22:35:45 +00:00