[gedit-list] Multithreading in gedit plugins



Hi there,

I need to execute some tasks in parallel threads to not block gedit. To initialize threading in PyGTK, I'm running "gtk.gdk.threads_init()" at the top of my plugin's "__init__.py".

To thread a method I use the following decorator:

-----
import threading

def threaded(f):
   """
   Threaded decorator
   """
   def wrapper(*args):
       t = threading.Thread(target=f, args=args)
       t.start()
   return wrapper
-----

When I apply this decorator like

-----
@threaded
def parseSomething(self):
   do_stuff()
-----

the method is _never_ run and a segmentation fault occurs when I quit gedit.

Has anyone of you experienced this yet? I'd be really thankful for any hint on how to solve this!


Thanks,
Michael


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