forked from enlightenment/efl
* ecore: fix possible race. It also make ecore_thread_run
match ecore_thread_feedback_run better. NOTE: I know it breaks API/ABI compatibility for that call, but that's the only sane solution I could found. SVN revision: 53370
This commit is contained in:
parent
75577ee618
commit
25e84c7f3d
|
@ -408,14 +408,14 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EAPI Ecore_Thread *ecore_thread_run(Ecore_Cb,
|
EAPI Ecore_Thread *ecore_thread_run(Ecore_Thread_Heavy_Cb func_blocking,
|
||||||
Ecore_Cb,
|
Ecore_Cb func_end,
|
||||||
Ecore_Cb,
|
Ecore_Cb func_cancel,
|
||||||
const void *data);
|
const void *data);
|
||||||
EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Heavy_Cb,
|
EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Heavy_Cb func_heavy,
|
||||||
Ecore_Thread_Notify_Cb,
|
Ecore_Thread_Notify_Cb func_notify,
|
||||||
Ecore_Cb,
|
Ecore_Cb func_end,
|
||||||
Ecore_Cb,
|
Ecore_Cb func_cancel,
|
||||||
const void *data,
|
const void *data,
|
||||||
Eina_Bool try_no_queue);
|
Eina_Bool try_no_queue);
|
||||||
EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread);
|
EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread);
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct _Ecore_Pthread_Worker
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
Ecore_Cb func_blocking;
|
Ecore_Thread_Heavy_Cb func_blocking;
|
||||||
} short_run;
|
} short_run;
|
||||||
struct {
|
struct {
|
||||||
Ecore_Thread_Heavy_Cb func_heavy;
|
Ecore_Thread_Heavy_Cb func_heavy;
|
||||||
|
@ -218,7 +218,7 @@ _ecore_short_job(Ecore_Pipe *end_pipe)
|
||||||
pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
|
pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
|
||||||
|
|
||||||
if (!work->cancel)
|
if (!work->cancel)
|
||||||
work->u.short_run.func_blocking((void *) work->data);
|
work->u.short_run.func_blocking((Ecore_Thread*) work, (void *) work->data);
|
||||||
|
|
||||||
ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
|
ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ _ecore_thread_shutdown(void)
|
||||||
* host CPU can handle.
|
* host CPU can handle.
|
||||||
*/
|
*/
|
||||||
EAPI Ecore_Thread *
|
EAPI Ecore_Thread *
|
||||||
ecore_thread_run(Ecore_Cb func_blocking,
|
ecore_thread_run(Ecore_Thread_Heavy_Cb func_blocking,
|
||||||
Ecore_Cb func_end,
|
Ecore_Cb func_end,
|
||||||
Ecore_Cb func_cancel,
|
Ecore_Cb func_cancel,
|
||||||
const void *data)
|
const void *data)
|
||||||
|
@ -508,7 +508,7 @@ ecore_thread_run(Ecore_Cb func_blocking,
|
||||||
If no thread and as we don't want to break app that rely on this
|
If no thread and as we don't want to break app that rely on this
|
||||||
facility, we will lock the interface until we are done.
|
facility, we will lock the interface until we are done.
|
||||||
*/
|
*/
|
||||||
func_blocking((void *)data);
|
func_blocking((Ecore_Thread *) work, (void *)data);
|
||||||
func_end((void *)data);
|
func_end((void *)data);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -525,7 +525,9 @@ ecore_thread_run(Ecore_Cb func_blocking,
|
||||||
* will return EINA_FALSE, if the destruction is delayed or EINA_TRUE if it is
|
* will return EINA_FALSE, if the destruction is delayed or EINA_TRUE if it is
|
||||||
* cancelled after this call.
|
* cancelled after this call.
|
||||||
*
|
*
|
||||||
* You should use this function only in the main loop.
|
* This function work in the main loop and in the thread, but you should not pass
|
||||||
|
* the Ecore_Thread variable from main loop to the worker thread in any structure.
|
||||||
|
* You should always use the one passed to the Ecore_Thread_Heavy_Cb.
|
||||||
*
|
*
|
||||||
* func_end, func_cancel will destroy the handler, so don't use it after.
|
* func_end, func_cancel will destroy the handler, so don't use it after.
|
||||||
* And if ecore_thread_cancel return EINA_TRUE, you should not use Ecore_Thread also.
|
* And if ecore_thread_cancel return EINA_TRUE, you should not use Ecore_Thread also.
|
||||||
|
|
Loading…
Reference in New Issue