On Thu, May 15, 2008 at 8:20 AM, Florent <[EMAIL PROTECTED]> wrote:

> * aren't the gobjects features (add_timeout, add_idle...) usable in a
> multi-threaded environment ? If threads_init() is called before
> clutter import, are the callbacks supposed to be threaded (i still
> noticed the freeze...) ?
>
> I tried using "stock" python threads as well, without much luck.
>

I'm using a combination of add_timeout's and 'stock' python threads and
whilst I do occasionally run into an issue, the following logic seems to
work:
1) Create thread: thread = threading.Thread(target=self.someFunction) and
start the thread
2) Within the threaded function, protect anything that modifies a clutter
object with 'clutter.threads_enter()' and 'clutter.threads_leave()'

The only major issue I have is when threads start doing CPU intensive tasks
the whole thing becomes CPU bound and any 'action' on the stage locks up.
You can get around this to a degree by using calls to sleep() within the
thread though.

Not saying its the best way, but its worked for me.

-Josh

Reply via email to