Using SaveThread and RestoreThread with callbacks
Adam Rutkowski
adam at cardaccess.com.au
Sun Oct 13 20:38:25 EDT 2002
More information about the Python-list mailing list
Sun Oct 13 20:38:25 EDT 2002
- Previous message (by thread): Using SaveThread and RestoreThread with callbacks
- Next message (by thread): Using SaveThread and RestoreThread with callbacks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Instead of PyEval_SaveThread/RestoreThread I'd say it's safer to use > the macro's Py_BEGIN_ALLOWTHREADS/Py_END_ALLOWTHREADS, because if you > forget or misplace one of them, you'll get a compile-time error. > These calls are only necessary in a multi-threaded application, and > only if the C-stuff may block other threads. If your C-stuff isn't > blocking, I don't see a reason to save/restore the thread state. > The application is multi-threaded, and the C code does block, so I have to use this to make it all work properly. The thing is, I didn't write the code, I'm just trying to fix it, so I wasn't entirely sure if the guy who wrote it was using the save and restore stuff correctly. I'll try using the macros instead, and see if that helps. Note that bug is that the app crashes occasionally with a fatal python error, and it looks like this is being caused by a state inconsistency, which is why I'm looking at this bit of the code. Thanks for the help so far! Adam
- Previous message (by thread): Using SaveThread and RestoreThread with callbacks
- Next message (by thread): Using SaveThread and RestoreThread with callbacks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list