- (values T
- (slot (slot itvo 'it-interval) 'tv-sec)
- (slot (slot itvo 'it-interval) 'tv-usec)
- (slot (slot itvo 'it-value) 'tv-sec)
- (slot (slot itvo 'it-value) 'tv-usec))
- which (alien-sap (addr itvn))(alien-sap (addr itvo))))))
-
-(defmacro with-timeout (expires &body body)
- "Execute the body, interrupting it with a SIGALRM after at least
-EXPIRES seconds have passed. Uses Unix setitimer(), restoring any
-previous timer after the body has finished executing"
- (let ((saved-seconds (gensym "SAVED-SECONDS"))
- (saved-useconds (gensym "SAVED-USECONDS"))
- (s (gensym "S")) (u (gensym "U")))
- `(let (- ,saved-seconds ,saved-useconds)
- (multiple-value-setq (- - - ,saved-seconds ,saved-useconds)
- (unix-getitimer :real))
- (multiple-value-bind (,s ,u) (floor ,expires)
- (setf ,u (floor (* ,u 1000000)))
- (if (and (> ,expires 0)
- (or (and (zerop ,saved-seconds) (zerop ,saved-useconds))
- (> ,saved-seconds ,s)
- (and (= ,saved-seconds ,s)
- (> ,saved-useconds ,u))))
- (unwind-protect
- (progn
- (unix-setitimer :real 0 0 ,s ,u)
- ,@body)
- (unix-setitimer :real 0 0 ,saved-seconds ,saved-useconds))
- ,@body)))))
+ (values t
+ (slot (slot itvo 'it-interval) 'tv-sec)
+ (slot (slot itvo 'it-interval) 'tv-usec)
+ (slot (slot itvo 'it-value) 'tv-sec)
+ (slot (slot itvo 'it-value) 'tv-usec))
+ which (alien-sap (addr itvn))(alien-sap (addr itvo))))))