The callback function, we often use it in Windows, but now let me provide the callback function to others, let me have a lot. How is this thing achieved? - I used to use someone else before.
What is a callback function? What is its principles mechanism? From the understanding of the English word to the analysis, I summed it myself, I don't know if it is correct, everyone gives some ideas.
Take a common approach:
The boss gives me a task (I am ruined), let me make a plan to the A project, complete as soon as possible, give him a call after completion, and tell him the quotation and project cycle, he wants to use the user Contact and the project assessment.
There are several elements in this:
1. Boss [Levelup] = upper layer
2, I [levelow] = bottom layer
3, A project [param] = parameter
4, phone [CallbackNumber] = contact information (C
ALL back Number
5, quotation and project cycle [RETDATA] = returned data
6, as soon as possible = no requirements
Map, therefore
Asynchronous way
7.
Contact users and assess the project evaluation = what you want to do after the boss receives the phone [the work to be completed]
So, the callback function can be understood as:
The upper layer is called, the address of the callback function is to notify the upper layer after completion of the next layer, and the return parameter of the callback function is to return the upper layer after the lower layer is completed, and the power to the callback function is the upper layer to receive notification and data. Good work.
Callback function is used:
1, asynchronous data processing
2, data exchange between the upper and lower layers
From the hierarchical relationship:
Upper layer application
"Interface" provided to the next application
Because it is a cross-layer, cross memory, therefore:
The callback function can only be passed in the form of an address, just like a phone number (tube is a office phone, or the mobile phone, you can find the boss if you play this phone).
At this point, there is a problem:
Although the Callback function's Codes is implemented by the upper layer, have the bottom layer have a Callback content embed to their own processes? Is Callback still completed in the user's entry? Alternatively, the bottom layer is only given a Singal. Is it still opposite?
If you can follow the above, Callback's Codes should run more reasonably on the upper memory segment. Or, Callback's Codes is in a Share / Common Memory?
I hope everyone will give some discussions.