Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFRunLoopTimerCallBack by reference?




On Mar 11, 2007, at 12:51 AM, led248 wrote:

I need to dispatch a lot of CFRunLoop timers with callbacks to several different functions. I'd like to write a single dispatch function that can specify the callback by *reference* rather than by name. I've never seen this done. Is it possible?

For example:

char* callbackRef = "myCallback";

CFRunLoopTimerRef timer = CFRunLoopTimerCreate (
/* CFAllocatorRef allocator */ kCFAllocatorDefault,
/* CFAbsoluteTime fireDate */ CFAbsoluteTimeGetCurrent() + delay,
/* CFTimeInterval interval */ 0, // 0 = fire once then invalidate
/* CFOptionFlags flags */ 0,
/* CFIndex order */ 0,
/* CFRunLoopTimerCallBack callout */ callbackRef, //----- nooooo way!
/* CFRunLoopTimerContext *context */ &context );


Can argument 6 of 'CFRunLoopTimerCreate' somehow be a reference, or is a const compile-time string the only possibility?

The 6th parameter is a function pointer, not a string. That function is called when the time fires. Your dispatch function could take a function pointer as a parameter, just like CFRunLoopTimerCreate does.


Larry

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >CFRunLoopTimerCallBack by reference? (From: led248 <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.