Home > DeveloperSection > Interviews > Define "Call Back".

Posted on    July-24-2015 12:22 AM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  385  View(s)
Rate this:

Mikki Halpin
Mikki Halpin

Total Post:5

Posted on    July-24-2015 12:22 AM

    Synchronous operations are ones that happen in step with your calling code. Most of Cocoa works this way: you send a message to an object, say to format a string, etc, and by the time that line of code is “done”, the operation is complete.
    But in the real world, some operations take longer than “instantaneous” (some intensive graphics work, but mainly high or variably latency things like disk I/O or worse, network connectivity). These operations are unpredictable, and if the code were to block until finish, it might block indefinitely or forever, and that’s no good.
    So the way we handle this is to set up “callbacks”– you say “go off and do this operation, and when you’re done, call this other function”. Then inside that “callback” function, you start the second operation that depends on the first. In this way, you’re not spinning in circles waiting, you just get called “asynchronously” when each task is done.

Modified On Apr-16-2016 02:01:12 AM

Don't want to miss updates? Please click the below button!

Follow MindStick