Re: [Quickfix-developers] QuickFIX Python and Twisted
Brought to you by:
orenmnero
|
From: Rich H. <rh...@ql...> - 2006-11-16 15:06:21
|
You also need to check if you are running on the main thread (the one that imported your module) before changing the thread state. I just check the current thread id (can be done on linux and windows). I've wrapped this in a helper class... like the Locker class. If anyone is interested, I can send it along. Cheers, Rich Oren Miller wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > We should be able to use Py_BLOCK_THREADS and Py_UNBLOCK_THREADS. > The _save variable will need to be global and protected. > > --oren > > On Nov 15, 2006, at 5:15 PM, Robert Parrott wrote: > > >> BTW, looking at these macro definitions, it isn't as easy as inserting >> the macros directly, since there are defined to be used in pairs, >> before and after. Instead, for the callbacks there will need to be >> either explicit code or new macros: >> >> (from ceval.h of python 2.3 ) >> >> PyAPI_FUNC(void) PyEval_InitThreads(void); >> PyAPI_FUNC(void) PyEval_AcquireLock(void); >> PyAPI_FUNC(void) PyEval_ReleaseLock(void); >> PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); >> PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); >> PyAPI_FUNC(void) PyEval_ReInitThreads(void); >> >> #define Py_BEGIN_ALLOW_THREADS { \ >> PyThreadState *_save; \ >> _save = PyEval_SaveThread(); >> #define Py_BLOCK_THREADS PyEval_RestoreThread(_save); >> #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); >> #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ >> } >> > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |