4

I want to implement a function which waits n seconds before retrying in case of a failure, but what would be the proper way of implementing the waiting-routine.

I figured that an endless loop with an if-clause might cause unwanted CPU-usage.

(do ((time (+ (get-universal-time) (- n 1)))
     (time-cur (get-universal-time) (get-universal-time)))
    ((< time time-cur) nil))

Therefore: Would this be considered proper code or is there a more standard way?

Sim
  • 4,199
  • 4
  • 39
  • 77

1 Answers1

6

Isn't SLEEP what your're looking for?

Vsevolod Dyomkin
  • 9,343
  • 2
  • 31
  • 36