Hi all,

I’m wondering if there’s a way to increase the stack size of the thread that 
opens my NSDocument in the background.

NSThread has a -setStackSize: method which would work, but it must be set prior 
to starting the thread. The problem is I don’t start the thread - Cocoa does. 
By the time my (e.g.) -readFromFileWrapper:ofType:error: method is called, it’s 
way too late.

I can programatically set the process stack limit using setrlimit(), but that 
doesn’t seem to affect additional threads such as the document opening one.

Anyone any idea how this could be done?

(The reason is that sometimes my documents can get very recursive during 
dearchiving - occasionally extremely large ones can hit the stack limit. Rather 
than redesign the scheme to be flatter, simply increasing the stack limit would 
probably get me out of this on the rare occasion it bites. After dearchiving, 
the object graph is flat, so the stack limit increase only needs to be 
temporary during dearchiving on the background thread).

—Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to