Re: Threading in a python extension?



Hi,

Le samedi 17 juin 2006 à 16:45 +0100, Magnus Therning a écrit :
> Ive started looking at making epilicious (an epiphany extension,
> written in Python, to synchronise local and Del.icio.us bookmarks)
> giving the user a bit more feedback. My idea was to spawn off a thread
> to do the actual synchronisation in order for the epiphany GUI to not
> lock up. Later I'd look into displaying a progressbar.
> 
> Unfortunately I got stuck on the first step. I create a threading.Thread
> object, passing in the synchronisation function as its target argument.
> Then I start the thread:
> 
>  def _menu_callback(action, window):
>    t = threading.Thread(target=_do_sync)
>    t.start()
> 
> I've added some calls to a logger (using logging.getLogger) first thing
> both in _menu_callback and in _do_sync. The first one is hit, but the
> second is never reached.
> 
> Is it possible to do a multi-threaded extension in Python at all?

It should be possible to do threading as long as you're careful to only
ever call gtk and epiphany functions from the main thread. There's at
least on (C++) extension that uses threading, the error viewer's link
validations functionality.

Regards,
	Christian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]