[Twisted-Python] reactor and thread
Hi all, I have a project where I writing the "server" (on win xp) and I want to communicate with a client, so twisted it's all I need. Into the "server" I have also a python bind to a dll (with ctypes) and I see strange problems (windows crashes) when I call a dll function inside a thread. My thread it's a twisted "Protocol". My question is: it is possible to call the function from/to a specific thread? So somethink like: class MyDll: def funct(self, callBack): #do the work reactor.call_in_main_thrad(callBack) tid = create_a_thread_and_load_MyDll() # where I make the dll instance and all the work need into a thread #into a someone function into the main thread def callBack(): # a simple callback reactor.callIntoThread(tid, funct, callBack) Is this possible with twisted? (Does I'm dreaming?) P.s. If I try with the wx "reactor" (so wx.MainLoop), I see no problem! In that case, I instance the dll into the class __init__ (inherit from wx.Frame) and into a someone event (i.e. Button click) I call a dll funct and all work without crash... Thanks, Michele
participants (3)
-
glyph@divmod.com
-
Gábor Bernáth
-
Michele Petrazzo - Unipex srl