Re: Pointer to id
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