• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: multithreading, cocoa, pools and POSIX
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: multithreading, cocoa, pools and POSIX
      • From: Luc Vandal <email@hidden>
References: 
 >multithreading, cocoa, pools and POSIX (From: Luc Vandal <email@hidden>)

  • Prev by Date: Protocol-related compilation warnings
  • Next by Date: Re: Protocol-related compilation warnings
  • Previous by thread: multithreading, cocoa, pools and POSIX
  • Next by thread: Re: multithreading, cocoa, pools and POSIX
  • Index(es):
    • Date
    • Thread