I'm trying to run dll functions from multithreaded GUI in wxpython.
When i try to run those functions from the 'Worker Thread' i get runtime error "abnornal program termination".
If i try to run the dll functions in the main loop thread, it works fine (but then the mainloop is blocked...)
the code looks something like this (worker thread is taken from wxpyhton book):
import xxx (xxx is the dll)
class WorkerThread(threading.Thread):
"""
This just simulates some long-running task that periodically sends
a message to the GUI thread.
"""
def __init__(self, threadNum, window, num_of_tests, ver, platform, savetodb, genfile, lock):
threading.Thread.__init__(self)
self.threadNum = threadNum
self.window = window
etc...
I hope your etc... has:
def run(self):
# do whatever dll stuff you are doing
wx.CallAfter(window.Method, argument) # return control to wx
Also, make sure you call thread.start() after you create an instance of your
thread class otherwise nothing will be done. I remember I once forget to do that.
I'm trying to run dll functions from multithreaded GUI in wxpython.
When i try to run those functions from the 'Worker Thread' i get runtime error "abnornal program termination".
If i try to run the dll functions in the main loop thread, it works fine (but then the mainloop is blocked...)
What is going on inside the dll function? Does it interact in any way with the main thread? With the GUI? Does it acquire/release the Python global interpreter lock?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!