Re: [Pyobjc-dev] Web Services Tool example broken
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2004-04-06 16:26:16
|
On 6-apr-04, at 16:21, Bob Ippolito wrote: > > On Apr 6, 2004, at 3:01 AM, Just van Rossum wrote: > >> Bob Ippolito wrote: >> >>> I have no idea how to reasonably debug that example, it freely mixes >>> ObjC and Python threading code. It's not even correct for at least >>> one reason: it doesn't detach an NSThread anywhere, so Foundation and >>> Cocoa are not notified to be thread safeish. Even though it did work >>> previously, that might have been by accident. >> >> Huh? The WST example goes through great pain not to call any GUI code >> from the worker threads, so I don't see why Cocoa needs to be >> notified. >> >> It's also the first time I hear that pure pthreads would be a no-no in >> Cocoa. Is that really so? How do NSThreads cooperate with the >> threading >> module? > > The thing is that Foundation and Cocoa needs to know about the threads > you are using in the same way that Python needs to know about them > (via PyGILState_Ensure, etc.). There is a hook and notification that > happens in Foundation when you detach your first NSThread (which this > program never explicitly does), and you are otherwise supposed to at > least call +[NSThread currentThread] from any raw pthread that expects > to call Foundation or Cocoa code (which this program also never does). > > That said, it's probably not WHY it doesn't work, I'm just saying the > program isn't strictly correct to begin with, and it uses threads, so > it will be hard to debug. It worked before the PyGILState_ changes, and doesn't work now. I'd say this is a PyObjC bug until proven otherwise. Luckily I've already fixed this problem: the wrapper for NSApplicationMain didn't release the GIL. Ronald > > -bob > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 |