RE: Question about handling SIGINT properly in Guile

2024-04-17 Thread Vijay Marupudi
Here's another simple reproduction, Guile's own webserver module (use-modules (web server)) (define (handler request body) (values '((content-type . (text/plain))) "Hello, World!")) (run-server handler) It needs two SIGINTs to properly end the program. I think I'm encountering a bu

RE: Question about handling SIGINT properly in Guile

2024-04-15 Thread Vijay Marupudi
Hi Maxime, Thank you for your thoughts! The documentation of libc suggests that the signal handler is run before any system call return EINTR, so I think Guile should have added the handler to the 'pending list' before the call to sleep returns. https://www.gnu.org/software/libc/manual/html_node

RE: Question about handling SIGINT properly in Guile

2024-04-14 Thread Maxime Devos
>Try running the simple reproduction included below. Try typing ^C (Ctrl+C) soon after the program begins. Sometimes "WORK" is run once, and sometimes "WORK" is run twice. What do I need to do to make "WORK" run only once in this instance? >(define quit? #f) >(sigaction SIGINT (lambda (arg) >

RE: Question about handling SIGINT properly in Guile

2024-04-14 Thread Maxime Devos
Sent from Mail for Windows From: Vijay Marupudi Sent: Saturday, 13 April 2024 22:24 To: Olivier Dion; guile-user@gnu.org Subject: Re: Question about handling SIGINT properly in Guile > So there is two things with signals. First, when a process get a signal > queued, the OS only deliv

Re: Question about handling SIGINT properly in Guile

2024-04-13 Thread Vijay Marupudi
> So there is two things with signals. First, when a process get a signal > queued, the OS only deliver the signal -- at least on linux -- when > going back to user-space. Typically, before the process get > re-scheduled or after a system call. So sending a signal is not > immediate. Furthermor

Re: Question about handling SIGINT properly in Guile

2024-04-13 Thread Olivier Dion
On Sat, 13 Apr 2024, Vijay Marupudi wrote: > Hello folk of guile-user, > > I am trying to create a simple Guile program that continues to perform a > task until an interrupt signal is sent. However, I am unable to > deterministically end the program when SIGINT is sent, as the > interrupt handler

Question about handling SIGINT properly in Guile

2024-04-13 Thread Vijay Marupudi
Hello folk of guile-user, I am trying to create a simple Guile program that continues to perform a task until an interrupt signal is sent. However, I am unable to deterministically end the program when SIGINT is sent, as the interrupt handler does not run soon after the call to (sleep ...) ends.