On Jul 20, 2005, at 12:46 PM, Robert Brown wrote:

> I would like to write a multithreaded application, mostly to take  
> advantage of dual processors... first, does Python's thread API do  
> this?  Last time I checked it would only run on one processor.

Python's thread API ensures that Python bytecode is only executing in  
one thread at a time.  However, much of Python is implemented in C  
and some of that code releases the Global Interpreter Lock.  So, it  
is possible to achieve some gains with threads if heavy lifting is  
done in C with the GIL released, but for pure Python code you'll  
probably end up slowing things down due to the synchronization overhead.

> I've written a thread class in ObjectiveC that works nicely.  It  
> uses Apple's distributed objects for communication.  It can be  
> called without problems from Python until one of the methods  
> returns (oneway void) instead of just (void), which is sort of  
> critical for useful threading.  When one of the methods is (oneway  
> void) Python crashes with a bus error.  If the ObjC thread class is  
> used by another ObjectiveC class (which itself has no oneway void  
> functions) there's no problem, everything works great.  This  
> problem occurs even if the object is not running on a different  
> thread, ie it's just a simple method call to a regular object  
> except that the method returns oneway void.
>
> Any ideas why PyObjC hates (oneway void) functions so much?

This is a bug but it has been fixed: use PyObjC from svn.

-bob

_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to