[Top][All Lists]

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

Re: Nicer way to wake sit-for up?

From: Kim F. Storm
Subject: Re: Nicer way to wake sit-for up?
Date: Thu, 08 Jun 2006 14:53:12 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) writes:

> I have a code where the command loop executes a command which is
> waiting for arriving data with sit-for. When the data arrives from the
> network a callback is invoked and I wake sit-for up with a dummy event
> like this:
> the callback:
>   ...
>   (setq unread-command-events (cons 'data-arrived
> unread-command-events))
>   ...

I can't think of a better way here, but you can just write

  (push 'data-arrived unread-command-events)

>   ...
>   (sit-for 5)
>   (if (eq (car unread-command-events) 'data-arrived)
>     (setq unread-command-events (cdr unread-command-events)))
>   ...

You could arrange for the data-arrived event to be ignored, e.g.

(define-key global-map [data-arrived] 'ignore)

Perhaps, you could use ignore instead of data-arrived, i.e.

   (define-key global-map [ignore] 'ignore)

   (push 'ignore unread-command-events)

Kim F. Storm

reply via email to

[Prev in Thread] Current Thread [Next in Thread]