From: mark.d.witmer@gmail.com
To: guile-user@gnu.org
Subject: A timely question on interrupted system calls
Date: Wed, 10 Jul 2013 23:45:06 -0700 [thread overview]
Message-ID: <87zjttk32l.fsf@mark-desktop.PK5001Z> (raw)
I followed the thread a few days ago on @guile-dev about SCM_SYSCALL and
was grateful I hadn't run into any problems with it. But now I have!
I'm working with an event loop for my X bindings that polls a socket for
availablity using `select'. Meanwhile, I have a repl server running in
another thread. When something connects to the server, the call to
`select' get interrupted and throws a system error. In the following
code the catch expression doesn't catch the system error:
(define (file-ready? fd)
(memq fd
(car
(catch 'system-error
(lambda () (select (list fd) '() '() 0 16667))
(lambda args
(if (= (system-error-errno args) EINTR)
'(() () ()) ;; Assume it isn't available for now
(apply throw args)))))))
I gathered from what I read that the error is getting handled in a
system async, which could explain why my catch expression doesn't see
it. I also tried a couple versions of `sigaction' without any luck:
(sigaction SIGINT (lambda (signum) #t) SA_RESTART)
and
(sigaction SIGINT #f SA_RESTART)
It'd be fine if it automatically retried instead of returning the empty
lists. Any ideas?
--
Mark Witmer
next reply other threads:[~2013-07-11 6:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 6:45 mark.d.witmer [this message]
2013-07-11 12:07 ` A timely question on interrupted system calls Ludovic Courtès
2013-07-12 4:26 ` mark.d.witmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjttk32l.fsf@mark-desktop.PK5001Z \
--to=mark.d.witmer@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).