Re: User-space threads and NSAutoreleasePool

2010-03-19 Thread BJ Homer
If only I could target 10.6... we just barely convinced management to let us drop 10.4. Someday... someday. -BJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the mod

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Jeremy Pereira
On 18 Mar 2010, at 06:41, BJ Homer wrote: > On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin wrote: > doing one transaction updating 400-500 records.) Hence, we pipeline the HTTP > requests, starting transfer of the second before the first one is finished. > There are a large number of servers that

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Michael Ash
On Thu, Mar 18, 2010 at 12:05 PM, Jens Alfke wrote: > > On Mar 18, 2010, at 8:35 AM, Michael Ash wrote: > >> Cocoa keeps around a lot of thread-specific state. In addition to >> autorelease pools, you also have exception handlers, graphics >> contexts, and possibly others. > > Yup. I quickly ran i

re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Ben Trumbull
> The problem is that when you call swapcontext() to switch the user-thread > running on a kernel-thread, the NSAutoreleasePool stack is not swapped out. > It remains rooted in thread-local storage. As a result, serious problems > result. Let me give an example. > > - (void)doStuff { > NSAutorele

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Jens Alfke
On Mar 18, 2010, at 8:35 AM, Michael Ash wrote: Cocoa keeps around a lot of thread-specific state. In addition to autorelease pools, you also have exception handlers, graphics contexts, and possibly others. Yup. I quickly ran into this in 2008 when experimenting with implementing coroutines

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Michael Ash
On Wed, Mar 17, 2010 at 11:11 PM, BJ Homer wrote: > Okay, so that's the setup. Obviously, the problem is that the two user-space > threads are sharing an autorelease pool stack that is intended to be > thread-local. My question, then, is whether there exists a way to get and > set the autorelease

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Manfred Schwind
> The problem is that when you call swapcontext() to switch the user-thread > running on a kernel-thread, the NSAutoreleasePool stack is not swapped out. > It remains rooted in thread-local storage. As a result, serious problems > result. Let me give an example. > > - (void)doStuff { > NSAutorele

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Jean-Daniel Dupas
Le 18 mars 2010 à 07:41, BJ Homer a écrit : > On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin wrote: >> >> Two main questions come to mind: >> >> Q1. What are you trying to accomplish? >> Q2. Why do you think this would work? >> >> More on Q1: You said you need user-space threads, but you gave

Re: User-space threads and NSAutoreleasePool

2010-03-17 Thread BJ Homer
On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin wrote: > > Two main questions come to mind: > > Q1. What are you trying to accomplish? > Q2. Why do you think this would work? > > More on Q1: You said you need user-space threads, but you gave no reason > or rationale. If it's because you need 500 t

Re: User-space threads and NSAutoreleasePool

2010-03-17 Thread Greg Guerin
BJ Homer wrote: I say all that in an effort to avoid the frequent "you're fighting the frameworks" responses. I'm well familiar with the frameworks, GCD, etc., and in this particular case, user-space threads is what I need. The problem is that when you call swapcontext() to switch the user-

User-space threads and NSAutoreleasePool

2010-03-17 Thread BJ Homer
Hi everyone, Some setup, first. If you just want to jump to the question, jump to the last paragraph. OS X includes (as part of its UNIX heritage) functions for implementing user-space threading. (See, for example, the man page on swapcontext