• 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: Luc Vandal <email@hidden>
  • Date: Tue, 07 Jun 2005 13:28:08 -0400

Ok!

I did that according to the sample given in the "Autorelease Pool" doc:

<x-tad-bigger>void main()
{
NSArray *args = [[NSProcessInfo processInfo] arguments];
unsigned count, limit = [args count];
for (count = 1; count < limit; count++){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *fileContents;
NSString *fileName;
fileName = [args objectAtIndex:count];
fileContents = [[NSString alloc] initWithContentsOfFile:fileName];
[fileContents autorelease];
/* Process the file, creating and autoreleasing more objects. */
[pool release];
}
/* Do whatever cleanup is needed. */
exit (EXIT_SUCCESS);
}</x-tad-bigger>


Luc


On 7-Jun-05, at 1:22 PM, Will Mason wrote:

Cocoa now seems to be in multithread mode. However, I still get a
crash
on [pool release]:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
BOOL b = [NSThread isMultiThreaded];
g_pFeedParam = pFeedParam;


NSNotification *notif = [NSNotification
notificationWithName:@"TextFeedCallback"
object:nil
userInfo:nil];


[[NSNotificationQueue defaultQueue] enqueueNotification:notif
postingStyle:NSPostNow];


[notif autorelease];
[pool release];

Am I doing something wrong?

Yes. You're double releasing notif. It comes to you already
autoreleased, so you don't need to autorelease it again.

Good luck,
Will
 _______________________________________________
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: Philip George <email@hidden>
References: 
 >Re: multithreading, cocoa, pools and POSIX (From: Will Mason <email@hidden>)

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