Re: [Pyobjc-dev] Achieving 1.0....
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ous...@ci...> - 2002-10-28 09:00:41
|
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?
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.
Ronald
|