Re: User-space threads and NSAutoreleasePool

2010-03-19 Thread Jeremy Pereira
On 18 Mar 2010, at 06:41, BJ Homer wrote: On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin glgue...@amug.org 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

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread BJ Homer
On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin glgue...@amug.org 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

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 glgue...@amug.org 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

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 {

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Michael Ash
On Wed, Mar 17, 2010 at 11:11 PM, BJ Homer bjho...@gmail.com 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

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

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 {

Re: User-space threads and NSAutoreleasePool

2010-03-18 Thread Michael Ash
On Thu, Mar 18, 2010 at 12:05 PM, Jens Alfke j...@mooseyard.com 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

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

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-