Reputation: 40624
I am in a situation that I need to tear apart an GUI application (written with wx and twisted, running on MS Windows), take out the core logic and deploy it as a cron job on a linux server that has no GUI environment.
I have replaced a number of wx.CallLater and wx.CallAfter with threading.timer. Apparently it does not work. The original code does not play well in the mulit-thread environment. It is probably because some underlying libraries are not thread safe. Threading also probably does not schedule jobs in the same manner as twisted.
So it is the typical workflow of the GUI app:
User toggles a button to start up a real-time data reader (written in C)
After toggle button turns green, it means the reader is up and running. User proceeds to switch between different real time data type
When the new set of data becomes ready, user will start using other functions in the app.
My questions:
How can I use twisted to recreate the above workflow? What tools in twisted allow me to wait for readiness of real-time data reader as mentioned in step 2?
Will everything just 'happen' in the main thread?
Upvotes: 1
Views: 197
Reputation: 48325
How can I use twisted to recreate the above workflow? What tools in twisted allow me to wait for readiness of real-time data reader as mentioned in step 2?
reactor.callLater
- http://twistedmatrix.com/documents/current/core/howto/time.html
Will everything just 'happen' in the main thread?
Yes - http://twistedmatrix.com/documents/current/core/howto/reactor-basics.html
Upvotes: 1