Update of /cvsroot/scsh/scx/scheme/xlib
In directory usw-pr-cvs1:/tmp/cvs-serv19414/scheme/xlib
Modified Files:
event.scm xlib-packages.scm
Log Message:
+ added a second version of wait-event. See event.scm for details.
Index: event.scm
===================================================================
RCS file: /cvsroot/scsh/scx/scheme/xlib/event.scm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** event.scm 2001/10/09 15:40:01 1.6
--- event.scm 2001/12/04 10:18:12 1.7
***************
*** 147,158 ****
;; wait-event blocks the current thread until an event is available,
;; and then it returns this new event.
- ;; In future releases this should be done with a select. But for now
- ;; we just do a loop with event-ready? and next-event. On this machine
- ;; that uses an acceptable amount of about 1% CPU-Time.
! (define (wait-event display)
! (if (event-ready? display)
! (next-event display)
(begin
(sleep 20) ; sleep for 20 ms
! (wait-event display))))
--- 147,170 ----
;; wait-event blocks the current thread until an event is available,
;; and then it returns this new event.
! ;; This does not work yet! We are working on it.
! ;(define (wait-event dpy) ; needs ports, locks
! ; (let ((port (display-message-inport dpy)))
! ; (display "obtaining port lock..." (current-error-port))
! ; (obtain-lock (port-lock port))
! ; (display " ...got it\n" (current-error-port))
! ;
! ; (display "waiting for events..." (current-error-port))
! ; (wait-for-channel (port->channel port))
! ; (display " ...receiving events.\n" (current-error-port))
! ;
! ; (release-lock (port-lock port))
! ; (next-event dpy)))
!
! ;; The old, ugly version that works...
! (define (wait-event dpy)
! (if (event-ready? dpy)
! (next-event dpy)
(begin
(sleep 20) ; sleep for 20 ms
! (wait-event dpy))))
Index: xlib-packages.scm
===================================================================
RCS file: /cvsroot/scsh/scx/scheme/xlib/xlib-packages.scm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** xlib-packages.scm 2001/10/30 14:31:36 1.8
--- xlib-packages.scm 2001/12/04 10:18:12 1.9
***************
*** 76,79 ****
--- 76,82 ----
external-calls
threads ;; for sleep
+ ports locks ;; for locking the port
+ channel-i/o ;; for wait-for-channel
+ scsh-level-0 ;; for port->channel
xlib-types)
(files event))
|