From: karol s. <kar...@gm...> - 2006-08-12 13:48:19
|
Hi guys, I am confused from behaviour of this piece of code: (let ((real-time (get-internal-real-time))) (sleep 0.01) (loop :for new-real-time = (get-internal-real-time) :repeat 1000000000 :do (if (> real-time new-real-time) (error "!!!!!!!!!! real-time = ~a, new-real-time = ~a~%" real-time new-real-time) (setf real-time new-real-time)))) If I understand correctly, new-real-time should be always greater or equal than time measured in executing previous iteration of loop. However, this is not true. I often get error which looks like this : !!!!!!!!!! real-time = 1276670, new-real-time = 1276669 [Condition of type SIMPLE-ERROR] Restarts: 0: [ABORT-REQUEST] Abort handling SLIME request. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {B4B7989}>) Backtrace: 0: (NIL) 1: (SB-INT:EVAL-IN-LEXENV (LET ((REAL-TIME #)) (SLEEP 0.01) (LOOP :FOR NEW-REAL-TIME = (GET-INTERNAL-REAL-TIME) :REPEAT 1000000000 :DO (IF # # #))) #<NULL-LEXENV>) 2: (SWANK::EVAL-REGION "(let ((real-time (get-internal-real-time))) (sleep 0.01) (loop :for new-real-time = (get-internal-real-time) :repeat 1000000000 :do (if (> real-time new-real-time) (error \"!!!!!!!!!! real-time = ~a, new-real-time = ~a~%\" real-time new-real-time) (setf real-time new-real-time)))) " T) When this errors happens, new-real-time is always real-time -1. I am using SBCL 0.9.14. My features are : (:SPLIT-SEQUENCE :SBCL-USES-SB-ROTATE-BYTE :ASDF :SB-THREAD :ANSI-CL :COMMON-LISP :SBCL :UNIX :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT :X86 :ELF :LINUX :GENCGC :STACK-GROWS-DOWNWARD-NOT-UPWARD :C-STACK-IS-CONTROL-STACK :STACK-ALLOCATABLE-CLOSURES :ALIEN-CALLBACKS :LINKAGE-TABLE :OS-PROVIDES-DLOPEN :OS-PROVIDES-DLADDR :OS-PROVIDES-PUTWC) Cheers, Karol Skocik |