Skip to content

Sys.sleep waits forever + workaround (PR#8678)

1 message · westfeld@inf.tu-dresden.de

#
When I tried to schedule a calculation for the next day (waiting several
10000 seconds), I noticed that Sys.sleep does never return (R version
2.1.0 on Linux). From the C code I expect that the maximum number of
seconds is about 2000 (2^31/1e6), which is system-dependent.

##Sys.sleep <- function(time)
##    invisible(.Internal(Sys.sleep(time)))

Sys.sleep <- function(time) {
        nloops <- time%/%1000
        while (nloops>0) {
                nloops <- nloops-1
                .Internal(Sys.sleep(1000))
        }
        invisible(.Internal(Sys.sleep(time%%1000)))
}