Re: multithreading, cocoa, pools and POSIX
Re: multithreading, cocoa, pools and POSIX
- Subject: Re: multithreading, cocoa, pools and POSIX
- From: Philip George <email@hidden>
- Date: Tue, 7 Jun 2005 11:40:43 -0500
i put the the following in apps i write that needs to be forced into
multithreaded mode:
@interface DeadThread : NSObject { ;; }
+ (void)enterMultiThreadedMode;
+ (void)emptyThreadMethod:(id)obj;
@end
@implementation DeadThread
+ (void)enterMultiThreadedMode {
[NSThread detachNewThreadSelector:@selector(emptyThreadMethod:)
toTarget:[DeadThread class] withObject:nil];
}
+ (void)emptyThreadMethod:(id)obj { ;; }
@end
then, before you spin your first pthread, call:
[DeadThread enterMultiThreadedMode];
hth.
- philip
On Jun 7, 2005, at 10:59 AM, Luc Vandal wrote:
Hi!
I've been reading about autorelease pools and I think I found why my
app is leaking memory badly. It seems that Cocoa is not in
multithreading mode and the POSIX thread that calls Cocoa code cannot
use NSAutoreleasePool (it crashes on [pool release]).
So I need some help to solve this issue because I don't really know
what to do! If anyone has some sample code or anything it would be
greatly appreciated!
What do I need to do? Set Cocoa to be in multithreading mode? Use the
autorelease pool elsewhere? I'm stuck!
Thanks!
Luc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden