For the Callback
article, I propose the same example that the first (from Jeff) but transposed to asynchronous callbacking via a thread: ...
dodicat wrote:There are quite a few definitions of asynchronous callbacks, some say that waiting for a return value makes the callback synchronous. In this case the the C sort callback and my own quicksort callbacks are synchronous.
Quote from stack overflow:
"In computer programming, a callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time. The invocation may be immediate as in a synchronous callback, or it might happen at a later time as in an asynchronous callback."
I start to get confused about the term callback. In the plotting example of fxm with the threads there is delay (asynchrone behavior) compared to the main thread. But the callback 'MathFunction' is still synchrone to its plotting thread.
This callback seems different compared to this:
1. I start a phone call and dial dodicat's number.
2. Dodicat is not at home, his sectary answers, I ask if dodicat can call me back later.
3. I end the pone call waits for dodicats call (back).
I think I saw a sound example on the forum some time ago where a callback was used whenever the playing device was nearing the end of the sound buffer and additional sound data was requested. There the whole callback mechanism made sense to me. Now, not so such.
Maybe the plotting example would make more sense if first some heavy calculation needs to be done before the plotting can start. This heavy calculation is the 1.5 second delay then.
Note: qsort example added to the page.