Threading in a python extension?



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?

/M

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus therning org             Jabber: magnus therning gmail com
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

When the people fear their government, there is tyranny; when the
government fears the people, there is liberty.
     -- Thomas Jefferson

Attachment: pgpT6IiVhuWzb.pgp
Description: PGP signature



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