On Tue, Jul 7, 2009 at 7:57 AM, Cedric BAIL<cedric.bail@...> wrote:
> On Tue, Jul 7, 2009 at 10:39 AM, Abhishek Bajpai<abhisheietk@...> wrote:
>> I am working on Edge/ Evas project. Where I am using Multiple Threads. I
>> want to update the canvas from a different thread. But the problem I am
>> facing is that the Canvas gets updated only when I touches the screen.
>> Do you have any idea. I have read some were that Evas /EFL is not thread
>> safe. Then how to do that ?????
> Yes, you should never touch Evas from outside of the thread that
> created it. The solution to your problem would be to synchronize your
> Evas with another thread at some point. If you use Ecore main loop,
> you can just create a pipe and use an Ecore fd handler
> (ecore_main_fd_handler_add). When you have a result from your
> computation thread, just write something to the pipe, this will start
> the corresponding Ecore event at some point in the main loop, in which
> you can touch your Edje/Evas objects.
This is true not only for evas, but ALL EFL. Do not use Ecore, Edje,
Embryo, Eet and even Eina from different threads, unless stated so. In
this case, the only API I remember being thread-safe is
ecore_pipe_write(). You create it on main thread with ecore_pipe_add()
and can (should) use ecore_pipe_write() from your worker thread.
Everything else should not be used from threads.
For example, if you're using Eina with standard mempool, lists will be
corrupted if used from other threads: its nodes will be allocated from
the pool without any locking, so two threads can get the same node
memory chunk and you know bad things will happen.
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
Mobile: +55 (19) 9225-2202