Re: [Pyobjc-dev] Achieving 1.0....
Brought to you by:
ronaldoussoren
From: pluto <pl...@ob...> - 2002-10-28 09:42:11
|
hi folks, i'm new to this list, i'm also new to macs and obj-c. i've been programming python for a several years as a living... and thats enough of an intro ;-) On Monday, October 28, 2002, at 01:00 AM, Ronald Oussoren wrote: > All, > > I just remembered one implementation issue that should be worked on > before reaching a 1.0 release: Thread safety. > > The current code is probably save for multi-threading, but I haven't > really checked this. Basicly I removed all static/global buffers while > working on the code. > > There are some more issues: > 1. Python has a global interpreter lock. When one thread owns this > lock, no > other thread can execute python code. The bridge currently never > gives up > the GIL when moving into native code and we probably should. I have > not yet > researched what we should do with callbacks from Objective-C to > Python. > > E.g. the NSApplicationMain wrapper should release the GIL before > calling > the actuall function, but how do you regain the GIL during calls to > methods > implemented in Python? > write a (objective) c wrapper that gets registered for the callback and takes a pointer to the python object to call. on callback reacquire the gil and call the object. > This is necessary to avoid unecessary blockage of Python threads > during > calls to Objective-C code. > > 2. Threads started using the Cocoa thread class(es) won't have a python > interpreter state. Special wrapping code should be written to > arrange for the > creation of that state. This can wait until item 1 is finished. > maybe it would be helpful to look at what pyqt or wxpython do in such cases. cheers, -p |