Changeset 4237


Ignore:
Timestamp:
10/07/03 02:08:35 (19 years ago)
Author:
piso
Message:

UPDATE-CHECK-ENABLED

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/examples/init.lisp

    r3798 r4237  
    11;;; init.lisp
    2 ;;; $Id: init.lisp,v 1.12 2003-09-15 19:05:17 piso Exp $
     2;;; $Id: init.lisp,v 1.13 2003-10-07 02:08:35 piso Exp $
    33
    44;;; ~/.j/init.lisp (if it exists) is loaded automatically when j starts up.
     
    7070                                 "{annie}mail/linux-kernel")))
    7171
     72;; In minutes.
     73(defparameter check-enabled-timeout 5)
     74
     75;; Don't resolve autoloads in the background thread!
     76(sys::resolve 'get-internal-real-time)
     77
     78(defun update-check-enabled ()
     79  (loop
     80    (sleep 60) ; 1 minute
     81    (let* ((last-event-time (get-last-event-internal-time))
     82           (current-time (get-internal-real-time))
     83           (timeout (* check-enabled-timeout 60 internal-time-units-per-second))
     84           (enable (if (> current-time (+ last-event-time timeout)) nil t)))
     85      (unless (eql (variable-value 'check-enabled :global) enable)
     86        (setf (variable-value 'check-enabled :global) enable)
     87        (log-debug "check-enabled => ~A"
     88                   (variable-value 'check-enabled :global))))))
     89
     90(defun start-update-check-enabled-thread ()
     91  (make-thread #'update-check-enabled))
     92
    7293(when (probe-file "/home/peter/.j/key-pressed.lisp")
    7394  (load "/home/peter/.j/key-pressed.lisp"))
Note: See TracChangeset for help on using the changeset viewer.