Re: abort in less than a second

2023-04-24 Thread polifemo
Thank you so much! I used poll to check for anything to read from stdin and
it worked flawlessly. Here's the code. It does not have any context, but it
is an example of how to use poll:

 '(loop
   (eval (loadRepeat))
   (wait 100)
   (T (and (poll 0) (= "53" (line T)))
(setq *Repite (list (loadRepeat) (loadRepeat))) ) )

Thank you all very much!

On Mon, Apr 24, 2023 at 12:45 AM Alexander Burger 
wrote:

> On Mon, Apr 24, 2023 at 06:45:06AM +0200, Danilo Kordic wrote:
> >   I would use Linux.epoll.  pil doesn't have it... yrt.
>
> PicoLisp has 'poll', which uses poll(2) or ppoll(2) internally.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: abort in less than a second

2023-04-23 Thread Alexander Burger
On Mon, Apr 24, 2023 at 06:45:06AM +0200, Danilo Kordic wrote:
>   I would use Linux.epoll.  pil doesn't have it... yrt.

PicoLisp has 'poll', which uses poll(2) or ppoll(2) internally.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: abort in less than a second

2023-04-23 Thread Alexander Burger
Hi polifemo,

> I have a loop that executes a prg and then waits for the user to input
> something. If the user does not input anything within the timeout, the
> waiting is aborted and the loop restarts.
> The problem is that, I want the timeout to be much faster, but 'abort only
> works in seconds. Is there a way to abort a program after M milliseconds?

Your question can be interpreted in two ways:

1. The program really just waits for user input.

   If this input can be handled on the keystroke level, you can call (key 100)
   to wait for 100 ms.

2. The loop is doing something and you want to interrupt that

   Then you can either use (poll 0) to check standard input in the loop,
   or install a signal handler like *Sig1 and do a (throw ...) in it.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: abort in less than a second

2023-04-23 Thread Danilo Kordic
  I would use Linux.epoll.  pil doesn't have it... yrt.

On Mon, Apr 24, 2023, 06:10 polifemo  wrote:

> I have a loop that executes a prg and then waits for the user to input
> something. If the user does not input anything within the timeout, the
> waiting is aborted and the loop restarts.
> The problem is that, I want the timeout to be much faster, but 'abort only
> works in seconds. Is there a way to abort a program after M milliseconds?
>