Changeset 15100
- Timestamp:
- Dec 1, 2011, 2:44:22 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/source/cocoa-ide/cocoa-listener.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/cocoa-ide/cocoa-listener.lisp
r15065 r15100 58 58 59 59 60 61 (defmethod dequeue-listener-char ((stream cocoa-listener-input-stream) wait-p) 60 (defmethod queued-listener-char ((stream cocoa-listener-input-stream) wait-p dequeue-p) 62 61 (with-slots (queue queue-lock read-lock queue-semaphore text-semaphore cur-string cur-string-pos) stream 63 62 (with-lock-grabbed (read-lock) 64 63 (or (with-lock-grabbed (queue-lock) 65 64 (when (< cur-string-pos (length cur-string)) 66 (prog1 (aref cur-string cur-string-pos) ( incf cur-string-pos))))65 (prog1 (aref cur-string cur-string-pos) (and dequeue-p (incf cur-string-pos))))) 67 66 (loop 68 67 (unless (if wait-p … … 76 75 (setq queue (delq s queue 1)) 77 76 (when (< 0 (length s)) 78 (setf cur-string s cur-string-pos 1)77 (setf cur-string s cur-string-pos (if dequeue-p 1 0)) 79 78 (return (aref s 0)))))))))) 80 79 … … 133 132 134 133 (defmethod enqueue-listener-input ((stream cocoa-listener-input-stream) string) 135 (with-slots (queue-lock queue queue-semaphore text-semaphore) stream 136 (with-lock-grabbed (queue-lock) 137 (setq queue (nconc queue (list string))) 138 (signal-semaphore queue-semaphore) 139 (signal-semaphore text-semaphore)))) 134 (when (> (length string) 0) 135 (with-slots (queue-lock queue queue-semaphore text-semaphore) stream 136 (with-lock-grabbed (queue-lock) 137 (setq queue (nconc queue (list string))) 138 (signal-semaphore queue-semaphore) 139 (signal-semaphore text-semaphore))))) 140 140 141 141 (defmethod stream-read-char-no-hang ((stream cocoa-listener-input-stream)) 142 ( dequeue-listener-char stream nil))142 (queued-listener-char stream nil t)) 143 143 144 144 (defmethod stream-read-char ((stream cocoa-listener-input-stream)) 145 (dequeue-listener-char stream t)) 145 (queued-listener-char stream t t)) 146 147 ;; The default implementation of peek-char will lose the character if aborted. This won't. 148 (defmethod stream-peek-char ((stream cocoa-listener-input-stream)) 149 (queued-listener-char stream t nil)) 150 151 (defmethod stream-listen ((stream cocoa-listener-input-stream)) 152 (queued-listener-char stream nil nil)) 146 153 147 154 (defmethod stream-unread-char ((stream cocoa-listener-input-stream) char)
Note:
See TracChangeset
for help on using the changeset viewer.
