Changeset 5020


Ignore:
Timestamp:
Aug 25, 2006, 7:17:15 PM (18 years ago)
Author:
Gary Byers
Message:

Rename EVENT-POLL to AUTO-FLUSH-INTERACTIVE-STREAMS.

Make AUTO-FLUSH-INTERACTIVE-STREAMS do conditional locking on each
stream (doing nothing if it's not :SHARING :LOCK; unconditional
locking on the *AUTO-FLUSH-STREAMS-LOCK*.

ADD-AUTOFLUSH-STREAM ensures that the stream is :SHARING :LOCK.

REMOVE-AUTOFLUSH-STREAM.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-events.lisp

    r4446 r5020  
    179179
    180180
    181 (defun event-poll ()
    182   (with-lock-grabbed-maybe (*auto-flush-streams-lock*)
     181(defun auto-flush-interactive-streams ()
     182  (with-lock-grabbed (*auto-flush-streams-lock*)
    183183    (dolist (s *auto-flush-streams*)
    184       (when (open-stream-p s)
    185         (stream-maybe-force-output s)))))
    186 
     184      (when (and (open-stream-p s)
     185                 (ioblock-outbuf-lock (stream-ioblock s t)))
     186        (maybe-stream-force-output s)))))
     187
     188(defun add-autoflush-stream (s)
     189  (with-lock-grabbed (*auto-flush-streams-lock*)
     190    (unless (member s *auto-flush-streams*)
     191      (let* ((ioblock (stream-ioblock s t)))
     192        (unless (ioblock-outbuf-lock ioblock)
     193          (setf (ioblock-outbuf-lock ioblock) (make-lock)
     194                (ioblock-owner ioblock) nil)))
     195      (push s *auto-flush-streams*))))
     196     
     197(defun remove-autoflush-stream (s)
     198  (with-lock-grabbed (*auto-flush-streams-lock*)
     199    (setq *auto-flush-streams* (delete s *auto-flush-streams*))))
    187200
    188201; Is it really necessary to keep this guy in a special variable ?
    189202(defloadvar *event-dispatch-task*
    190203  (%install-periodic-task
    191    'event-poll
    192    'event-poll
     204   'auto-flush-interactive-streams
     205   'auto-flush-interactive-streams
    193206   33
    194207   (+ $ptask_draw-flag $ptask_event-dispatch-flag)))
Note: See TracChangeset for help on using the changeset viewer.