chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Is there a way to get tcp-accept to time-out?


From: Julian Morrison
Subject: Re: [Chicken-users] Is there a way to get tcp-accept to time-out?
Date: Fri, 25 Feb 2005 04:01:05 +0000
User-agent: Debian Thunderbird 1.0 (X11/20050116)

Ed Watkeys wrote:

Hi all,

Anyone know of a way to get tcp-accept to time-out? Or, barring that, is there a way I can get a file descriptor from a listener so I can call file-select with it?

Will this help:

(declare (uses posix))
(define (call-with-timeout duration-in-seconds thunk)
  (call-with-current-continuation
   (lambda (timeout)
      (let ((before (lambda ()
                       (set-signal-handler! signal/alrm
                                            (lambda (signal-number)
                                               (timeout #f)))
                       (set-alarm! duration-in-seconds)))
(after (lambda ()
                       (set-signal-handler! signal/alrm #f)
                       (set-alarm! 0))))
         (dynamic-wind before thunk after)))))




reply via email to

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