Re: What means "callback function" and "signal handler" - are they DIFFERENT?



>I know that signals are tied to functions.
>These are called "signal handlers" I believe.
>
>Is this also called a "callback function" or
>does that mean something else?
>
>Callback seems like a strange name since
>nothing is being called back to anywhere.

"callback" is a somewhat older term that comes from the idea of
registering a function (by passing the address of the function) with
some object/system; later, when certain conditions arise, the
object/system will "call you back" by calling the function you
registered, passing (variously) its own arguments and/or any that you
supplied when registering it.

GTK+ signal handlers are just one example of a callback system;
because the GTK+ design adds some additional semantics to the simplest
model of a callback system, and for other reasons, they decided to
call it something else.

BTW, if you're working in C++, I don't know why you're not using gtkmm
instead of straight GTK+. its a thin wrapper that provides a much more
C++-style idiom for programming in, plus it comes with one of the most
awesome and useful callback systems ever written (libsigc++) that uses
the power of C++'s template programming to make things possible that
have always been (and continue to be) an annoyance in C.

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]