Re: @selector not working with (id)anObject

2009-04-12 Thread Scott Ribe
> Basically I just need to use a function pointer. How does Cocoa do this? Put a function pointer member in your class and set it before you call detachNewThreadSelector on it... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice _

Re: @selector not working with (id)anObject

2009-04-11 Thread Michael Ash
2009/4/11 Trygve Inda : > [NSThread detachNewThreadSelector:@selector(threadMethod:) toTarget:self > withObject:@selector(myMethod)]; This should have produced a warning like this: warning: passing argument 3 of ‘detachNewThreadSelector:toTarget:withObject:’ from incompatible pointer type If it

Re: @selector not working with (id)anObject

2009-04-11 Thread Bill Bumgarner
Sigh. Hit shift-cmd-D a bit too soon. :) It does not seem I can invoke this on the main thread. An NSInvocation? [invocation performSelectorOnMainThread: @selector(invokeWithTarget:) withObject: ...whatever... waitUntilDone: NO]; Basically I just need to use a function pointer. How does C

Re: @selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
>> It does not seem I can invoke this on the main thread. > An NSInvocation? >> Basically I just need to use a function pointer. How does Cocoa do >> this? >> >> I need to pass either someMethod or someOtherMethod and later call >> it with >> >> [self performSelectorOnMainThread:theMethod withO

Re: @selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
> 2009/4/11 Trygve Inda > > I have a thread. Depending on how it is called, I need to do something >> different at the end of the main processing so I wanted to pass a selector >> into the thread so it could call it when it was ready. >> >> I could just pass an NSNumber and do case1, case2 etc,

Re: @selector not working with (id)anObject

2009-04-11 Thread Sherm Pendley
2009/4/11 Trygve Inda I have a thread. Depending on how it is called, I need to do something > different at the end of the main processing so I wanted to pass a selector > into the thread so it could call it when it was ready. > > I could just pass an NSNumber and do case1, case2 etc, but thought

Re: @selector not working with (id)anObject

2009-04-11 Thread Bill Bumgarner
On Apr 11, 2009, at 5:32 PM, Trygve Inda wrote: So one of these needs to be called: [self performSelectorOnMainThread:@selector(cacheComplete) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(initComlete) withObject:nil waitUntilDone:NO]; Thoughts? On Apr

Re: @selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
> On Apr 11, 2009, at 5:20 PM, Trygve Inda wrote: >> -(void)threadMethod:(id)anObject >> { >> NSAutoreleasePool*pool = [[NSAutoreleasePool alloc] init]; >> SEL comp = (SEL)anObject; >> >>... Do stuff ... >> >> [self performSelectorOnMainThread:comp withObject:nil >> w

Re: @selector not working with (id)anObject

2009-04-11 Thread Bill Bumgarner
On Apr 11, 2009, at 5:20 PM, Trygve Inda wrote: -(void)threadMethod:(id)anObject { NSAutoreleasePool*pool = [[NSAutoreleasePool alloc] init]; SEL comp = (SEL)anObject; ... Do stuff ... [self performSelectorOnMainThread:comp withObject:nil waitUntilDone:NO]; [pool

@selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
[NSThread detachNewThreadSelector:@selector(threadMethod:) toTarget:self withObject:@selector(myMethod)]; -(void)threadMethod:(id)anObject { NSAutoreleasePool*pool = [[NSAutoreleasePool alloc] init]; SEL comp = (SEL)anObject; ... Do stuff ... [self performSelecto