[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What do 'hooks' do and how do they do it?
From: |
Dirk-Jan C . Binnema |
Subject: |
Re: What do 'hooks' do and how do they do it? |
Date: |
Sat, 01 Aug 2009 21:00:33 +0300 |
User-agent: |
Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0 (HANACHIRUSATO) |
Hi Bill,
>>>>> "Bill" == William Case <billlinux@rogers.com> writes:
Bill> Hi;
Bill> This is not an urgent question, it is more in the way of a request for
Bill> an explanation by anyone who has the time and inclination to do a
little
Bill> teaching.
Bill> I know at a high level what a 'hook' is and how to use it an elisp
Bill> statement. And, I have seen hooks used in other programs like
SELinux.
Bill> But I am curious about what is going on at the kernel level with a
Bill> 'hook'. If someone can give me a brief overview in relatively plain
Bill> language, I would appreciate it.
Bill> e.g. some of the kind of questions that spring to mind.
Bill> Is it a process that is added to the task structure waiting to be
Bill> called?
Bill> How is it woken up? And what kind of events might wake it? etc.
I think Drew Adams gave a very clear answer about the Emacs implementation,
but let me add that the concept of a 'hook' is simply a programming technique:
the ability to set some function to be run whenever a particular event
happens.
The concept is in use in many places (such as SE-Linux), but how it's
implemented is quite different. In Emacs-Lisp, the hooks are simply Lisp
functions to be called -- no kernel involved (well...).
See: http://en.wikipedia.org/wiki/Hooking
Best wishes,
Dirk.
--
Dirk-Jan C. Binnema Helsinki, Finland
e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C