what's a callback?

I am thinking of real-time assembler- you are doing something else. If these tasks to be done have some global status variable indicating the what service tasks have been done and are yet to be done, then a re-entrant ISR which reads this status does what you want.

Reply to
Fred Bloggs
Loading thread data ...

"Fred Bloggs" schreef in bericht news: snipped-for-privacy@nospam.com...

It is a simple concept. I think the word 'hook was more common with hardware interrupts or hardware related bios calls. Later, with graphical user interfaces, Apple Mac and GEM, these mechanisms were named callbacks. I guess, under that name they must be around for

20-25 years...
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Reply to
Frank Bemelman

Example. Take the Windows GDI LineDDA function. It takes 2 points as input and calculates all points that make a line between them. Now LineDDA calculates the first point, but it can't just return to the caller because the other points have to be calculated too. OTOH, it doesn't know what to do with the point (should it be drawn on a canvas, or added to a list?) That's why the calling routine has to supply a pointer to a callback function. Each time LineDDA has calculated a point it passes it to the callback function. The callback function may draw the point on a canvas, that's part of the application, and after it's done it returns control back to the LineDDA function, which then goes on to calculate the next point. So the application calls LineDDA, and during the LineDDA algorithm it calls back an application function. In the LineDDA case the callback will called several times, but it could also be just once.

Another example. Hans-Bernhard already mentioned sorting. Sorting can only be done within ordered set. Numerical lists are ordered differently from numerical lists, so you'll have different compare functions. Apart from the comparison itself however, the sorting algorithm can be the same for any type of set. So you write a sort routine requiring a callback function. The sorting routine knows when which item should be compared to which other. That's defined in the algorithm. But it doesn't know how thsi comparison is to be done. So it calls the callback, saying "hey, I've got an item A and an item B here which require comparison. Which should go first?". The callback function decides and returns the result to the sorting routine, which may e.g. decide that A and B should be swapped.

HTH

-- Steven

Reply to
steven

My experience with them is that when a piece of system software loads, such as a device driver, that any application might want to call without knowing where it is located, the driver will load an address in a system table (tied to hardware or software interrupts, perhaps) so the application can find the function when needed.

Reply to
Richard Henry

When you pass the address of a subroutine (usually in your code) to something so that something can call the passed subroutine the subroutine would often be called a callback.

Typically used for things like a list iterating routine where the callback would be called for each item in the list.

Reply to
nospam

It's just windows hyperbola. Click a (say) button somewhere and the ID number you gave the button is stored on the "message" stack. At some point in your prog' you may wish to rummage through the messages to see if that particular number has turned up. If you've a PowerBasic for windows, the help file makes a (bad!) effort to describe it. regards john

Reply to
john jardine

"I have a theory that all Scottish food is based on a dare" (Mike Meyers)

I've tried haggis and it doesn't taste as disgusting as the ingredients suggest. The sheep's stomach is as thin and inoffensive as a sausage skin, and does the same job of holding it all together. Sausage skins were traditionally pigs intestines, but few people think sausages are disgusting.

As for the rest, only lamb's liver sounds bad but even that is okay if cooked well (e.g. as a small part of a grilled lamb chop)

IMHO it just looks like a poor but canny Scots lass faced with a Spartan pantry had a good go at stretching a small cheap cut of offal into flavouring the largest portion of sausage-substitute.

I found it a bit dry. Needs a good gravy, or dampening with a splash of whisky (oh yes, it's not just for cornflakes).

That is made of cow stomach, and is about 7 mm thick. I hear it can be edible if cooked properly and even made to look okay (fried in breadcrumbs like plaice).

But as you may know, we English are famous for boiling food to leach out the flavour and vitamins into the water, then throwing the water away and eating what is left.

That counts as child abuse IMHO.

Along with school dinners. The people responsible should have their livers boiled for hours until grey and rubbery, then made to eat them. Dr. Lecter, we have a job for you!

My mate has to go to Taiwan. He hates the endless kimchi. I advised him not to ask for hot dog.

Sea cucumber is much the same as squid.

The guy who first looked at a squid/octopus/oyster and thought "I'll try eating that". I bet he was bloody hungry.

And what is the deal with oysters? It's a fish built like a nut...

Reply to
Kryten

A callback is a function you register (store a pointer in a table, for example) with some sort of scheduling routine that you want run when some event occurs.

In the purest sense of things, ISRs are pieces of code that are called when some (physical) event occurs and are run 'outside' of the scheduled tasks. In many OSs, ISRs are actually split into two parts, the 'bottom' and 'top' halfs. The bottom half is the code that must be run at interrupt time to save I/O data, reset h/w for the next event and set a flag or schedule a task to do further processing for the event. The 'top half' is the scheduled task that completes the processing necessary to handle the event. This might be referred to as a 'callback' in some systems.

--
Paul Hovnanian     mailto:Paul@Hovnanian.com
------------------------------------------------------------------
You can discover what your enemy fears most by observing the
means he uses to frighten you. -- Eric Hoffer
Reply to
Paul Hovnanian P.E.

Actually, I've heard it compared to something else altogether.

Reply to
Richard Henry

That's a flag. Here's a good explanation of callbacks:

formatting link

Best,

Mike Monett

Reply to
Mike Monett

Well.....I guess if it were to be really pure code, all addresses would have to be relative to the instruction counter. ;-) We used to call this floatable code as it could be just plunked into memory anywhere and executed.

Reply to
Anthony Fremont

I would think all the beef fat (suet) would keep it moist.

Menudo, a traditional Mexican tripe soup and miraculous hangover cure.

I don't think they are anything like squid. Squid are like tubes with tentacles and if no prepared correctly can be quite rubbery. Sea cucumbers are more like really stiff gelatin in texture and have no taste of their own and take on the taste of whatever sauce they are cooked in.

Reply to
Craig Bergren

My (perhaps non-professional-programmer) definition of that is "relocatable" or "PIC" (position independent) code.

"Pure" code is code that has no associated statics and if of course not self-modifying, so that it can be executed by multiple threads without hassle.

John

Reply to
John Larkin

A simple flag does not constitute a callback, what you are describing is simply persistent memory.

Callbacks are used when a routine (typically event driven), doesn't know what else needs to be done for an event. All it knows is when the event occurs, if there is a procedure address defined, to call it (back).

If you look at publish/subscribe, you have a multiple call back situation. Every client subscribes to the event by passing an execution address which the publisher (server) keeps in a list. When the event occurs, the server "calls back" all the functions passed by the subscribing clients.

Of course, publish/subscribe can also be done with messages or signals, too. The end result is pretty much the same. (Though nigglers will tell you the direct call back has threading and context issues...)

Rufus

Reply to
Rufus V. Smith

I read in sci.electronics.design that John Larkin wrote (in ) about 'what's a callback?', on Mon, 20 Dec 2004:

A veritable model of recidivism!

--
Regards, John Woodgate, OOO - Own Opinions Only. 
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Reply to
John Woodgate

Looks like a giant maggot.. Fancy some geoduck?

formatting link

Regards,

Boris Mohar

Got Knock? - see: Viatrack Printed Circuit Designs

formatting link

Reply to
Boris Mohar

I read in sci.electronics.design that Boris Mohar wrote (in ) about 'what's a callback?', on Mon, 20 Dec 2004:

I can't even pronounce it.

-- Regards, John Woodgate, OOO - Own Opinions Only. The good news is that nothing is compulsory. The bad news is that everything is prohibited.

formatting link
Also see
formatting link

Reply to
John Woodgate

formatting link

Regards,

Boris Mohar

Got Knock? - see: Viatrack Printed Circuit Designs

formatting link

Reply to
Boris Mohar

A callback is a function call to a fuction that at design time does not yet exist.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

What a strange thread. Full of misinformation such as this.

Steve

formatting link

Reply to
Steve at fivetrees

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.