• 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: Pointer to id
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pointer to id


  • Subject: Re: Pointer to id
  • From: Camillo Lugaresi <email@hidden>
  • Date: Mon, 2 Jan 2006 12:39:05 +0100

On 02/gen/06, at 12:08, Sanri Parov wrote:

mmmhhhh.....
I've tried doing this:

NSValue *value;
value = [NSValue valueWithPointer:@encode(PortAudioStream *)];
[value retain];
[NSThread detachNewThreadSelector: @selector(playForSure:) toTarget: nil withObject:value];

Don't use @encode with valueWithPointer. It takes an actual pointer, not a pointer type. Also, you shouldn't retain value, detachNewThreadSelector will take care of it. Use something like this:


PortAudioStream  *stream;

/* put code to initialize stream here */
[NSThread detachNewThreadSelector: @selector(playForSure:) toTarget:self withObject:[NSValue valueWithPointer:pas]];


assuming that the object which should handle the playForSure message is self; otherwise, change it as needed.

The selector should be like this:

- (void)playForSure:(NSValue *)streamValue;
{
	PortAudioStream  *stream;
	NSAutoreleasePool *pool;

	pool = [[NSAutoreleasePool alloc] init];
	stream = [streamValue pointerValue];

	/* put your code here */

	[pool release];
}

Camillo
_______________________________________________
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


References: 
 >Pointer to id (From: Sanri Parov <email@hidden>)
 >Re: Pointer to id (From: Pontus Ilbring <email@hidden>)
 >Re: Pointer to id (From: Sanri Parov <email@hidden>)

  • Prev by Date: Re: Trying to draw numbers into a dock icon badge
  • Next by Date: Re: KVO one-step listening but two-step notifying?
  • Previous by thread: Re: Pointer to id
  • Next by thread: Re: Pointer to id
  • Index(es):
    • Date
    • Thread