I am writing an Objective-C wrapper for CFRunLoopSource called
KLSRunLoopSource, that matched a Version 0 run loop source to an object by
using delegation for callbacks. Now I have problem mapping the schedule and
cancel callbacks to Objective-C.
Constructing the CFRunLoopSourceContext using Objective-C object is not that
difficult as several toll-free bridged methods between NSObject and CFTypeRef
can be leveraged like the following, but three callbacks have to be delegated:
_runLoopSourceContext.version = 0;
_runLoopSourceContext.info = (__bridge void *)self;
_runLoopSourceContext.retain = CFRetain; // [self retain]
_runLoopSourceContext.release = CFRelease; // [self release]
_runLoopSourceContext.copyDescription = CFCopyDescription; // [self
description]
_runLoopSourceContext.equal = CFEqual; // [self equal:]
_runLoopSourceContext.hash = CFHash; // [self hash]
_runLoopSourceContext.schedule = _KLSRunLoopSourceDidSchedule; // [self
didAddToRunLoop:inMode:]
_runLoopSourceContext.cancel = _KLSRunLoopSourceDidCancel; // [self
didRemoveFromRunLoop:inMode:]
_runLoopSourceContext.perform = _KLSRunLoopSourcePerform; // [self
didTrigger];
The last three call back functions, beginning with _KLS, are the ones that will
eventually call the delegate methods. However for delegate methods, didAdd and
didRemove call for an NSRunLoop object that should map to the corresponding
CFRunLoop passed into my call back. Any suggestions on how to do it?
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com