[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Signals / Messages / Events / ...?
From: |
Christopher Howard |
Subject: |
Re: Signals / Messages / Events / ...? |
Date: |
Wed, 03 Jan 2018 06:11:20 -0900 |
On Wed, 2018-01-03 at 11:53 +0000, Neil Jerram wrote:
>
> Well, one Lispy mechanism in that area is hooks. For example, from
> some
> of my old code:
>
> ;; Changes to modem registration state are indicated by calling this
> ;; hook with args STATE and PROPERTIES. STATE can be 'none, meaning
> ;; that there is currently no modem; 'unregistered, meaning that
> there
> ;; is a modem but it isn't registered with the network; or
> ;; 'registered, meaning that the modem is registered with the
> network.
> ;; If STATE is 'registered, PROPERTIES is an alist of registration
> ;; properties; otherwise PROPERTIES is #f.
> (define registration-hook (make-hook 2))
>
> (define (add-registration-hook proc)
> (add-hook! registration-hook proc))
>
> (define (notify-registration state properties)
> (run-hook registration-hook state properties))
>
> Does that serve your purpose at all?
>
> Best wishes - Neil
>
>
I think that should work. Only part I'm not sure about is if you can
have a "one-off" procedure added to a hook... but you could just have
the procedure call remove-hook! to remove itself...?
--
https://www.debian.org/
signature.asc
Description: This is a digitally signed message part