0

I'm trying to define custom input source for CFRunLoop, I've read the Threading Programming Guide document wrote by Apple and this problem is the only one that I cannot understand.

So, I want to know what is the purpose of CFRunLoopScheduleCallBack function or how to implement this function?

Sherlock
  • 13
  • 4

1 Answers1

0

This callback is called when your source is added to the run loop. You can leave it empty if you don't need any custom code to run on this event.

You implement it like this:

void MyCallBack (void *info, CFRunLoopRef rl, CFStringRef mode) { // code }

Jacek Lampart
  • 1,741
  • 13
  • 25
  • I know this function called when custom input source added to the run loop. If I don't want to leave this function empty, what should I do? or what is the correct code I need to write? Another words, if this function not empty, then what is the effect of these code in this function? – Sherlock Jan 10 '16 at 04:34
  • That's up to you, really - this callback is just an occasion for you to run some code. If you don't know what code to run, don't run any. You can find an example of what you could do here: https://github.com/hrchen/ExamplesForBlog/blob/19f516add0b22e4e49846aafede93de665b79686/NSThreadExample/NSThreadExample/PTInputSource.m#L57 – Jacek Lampart Jan 10 '16 at 05:13