Threading a lengthy C function
Robin Becker
robin at jessikat.fsnet.co.uk
Thu Nov 20 13:18:49 EST 2003
More information about the Python-list mailing list
Thu Nov 20 13:18:49 EST 2003
- Previous message (by thread): Threading a lengthy C function
- Next message (by thread): Threading a lengthy C function
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
. ..... >If the original posters intent is simply to call functions in a dll, he >should probably try out ctypes - ctypes handles the GIL automatically >(release before calling the function, acquire it back after return of >the function, and even grabbing the GIL if a callback into Python is >done). And it avoids SWIG completely. > >Thomas I'm not sure I understand how the last part is done unless all callback functions are known to ctypes and even then I'm not sure how ctypes would know how to associate a particular call back event with the owner thread. Are ctypes callbacks somehow defined uniquely for each callout? The other thing I never quite get is what part of the C api I'm allowed to use without having the GIL I think it safest to assume I may not call any python api without having it. Wrapping completely independent DLLs seems reasonable, but how does ctypes know that a particular extension/dll actually assumes that it has the GIL at entry which is mostly what extensions need. -- Robin Becker
- Previous message (by thread): Threading a lengthy C function
- Next message (by thread): Threading a lengthy C function
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list