Changes for Cygwin.
This commit is contained in:
parent
ec5d343b75
commit
435afc1e2b
|
@ -38,9 +38,6 @@
|
|||
/* Define if your sys_errlist is a const definition */
|
||||
#undef HAVE_CONST_SYS_ERRLIST
|
||||
|
||||
/* Include info we know about the system from config.scsh */
|
||||
#include "scsh/machine/sysdep.h"
|
||||
|
||||
/* Define if you have the nlist() function. This is a
|
||||
not-very-portable way of looking up external symbols. */
|
||||
#undef HAVE_NLIST
|
||||
|
@ -55,6 +52,8 @@
|
|||
|
||||
#undef HAVE_HARRIS
|
||||
@BOTTOM@
|
||||
/* Include info we know about the system from config.scsh */
|
||||
#include "../scsh/machine/sysdep.h"
|
||||
|
||||
#include "fake/sigact.h"
|
||||
#include "fake/strerror.h"
|
||||
|
|
|
@ -65,7 +65,7 @@ dnl
|
|||
define(S48_USCORE, [dnl
|
||||
AC_MSG_CHECKING([underscore before symbols])
|
||||
echo 'main() { return 0; } fnord() {}' >conftest.c
|
||||
if ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c ${LIBS} &&
|
||||
if ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o a.out conftest.c ${LIBS} &&
|
||||
nm a.out | grep _fnord >/dev/null; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(USCORE)
|
||||
|
@ -154,7 +154,7 @@ AC_DEFUN(SCSH_SIG_NRS, [
|
|||
AC_DEFINE_UNQUOTED(SIGNR_29, `./scsh_aux 29`, scsh interrupt for signal 29)
|
||||
AC_DEFINE_UNQUOTED(SIGNR_30, `./scsh_aux 30`, scsh interrupt for signal 30)
|
||||
AC_DEFINE_UNQUOTED(SIGNR_31, `./scsh_aux 31`, scsh interrupt for signal 31)
|
||||
rm -f scsh_aux
|
||||
rm -f scsh_aux scsh_aux.exe
|
||||
])
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
AC_DEFUN(SCSH_LINUX_STATIC_DEBUG, [
|
||||
|
@ -359,7 +359,7 @@ fail
|
|||
AC_MSG_RESULT([no]))
|
||||
S48_USCORE
|
||||
S48_RDYNAMIC
|
||||
SCSH_TZNAME
|
||||
AC_STRUCT_TIMEZONE
|
||||
SCSH_GMTOFF
|
||||
SCSH_CONST_SYS_ERRLIST
|
||||
CFLAGS1=${CFLAGS}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
; Copyright (c) 1999-2001 by Martin Gasbichler. See file COPYING.
|
||||
|
||||
;;; Functional event system.
|
||||
;;; System by Olin Shivers, implementation by Martin Gasbichler
|
||||
|
||||
(define-record-type event :event
|
||||
(really-make-event type next)
|
||||
event?
|
||||
(type event-type set-event-type!)
|
||||
(next next-event set-next-event!))
|
||||
|
||||
(define (make-event type)
|
||||
(really-make-event type #f))
|
||||
|
||||
(define empty-event (make-event #f))
|
||||
|
||||
(define *most-recent-event* empty-event)
|
||||
|
||||
(define (most-recent-event) *most-recent-event*)
|
||||
|
||||
(define event-thread-queue #f)
|
||||
|
||||
;Wait for an event of a certain type.
|
||||
(define (rts-wait-interrupt set pre-event type-in-set?)
|
||||
(with-interrupts-inhibited
|
||||
(lambda ()
|
||||
(let lp ((event (next-event pre-event)))
|
||||
(if event
|
||||
(if (type-in-set? (event-type event) set)
|
||||
event
|
||||
(lp (next-event event)))
|
||||
(begin (enqueue-thread! event-thread-queue (current-thread))
|
||||
(block)
|
||||
(lp (next-event pre-event))))))))
|
||||
|
||||
; same as above, but don't block
|
||||
(define (rts-maybe-wait-interrupt set pre-event type-in-set?)
|
||||
(let ((event (next-event pre-event)))
|
||||
(if event
|
||||
(if (type-in-set? (event-type event) set)
|
||||
event
|
||||
(rts-maybe-wait-interrupt set (next-event event) type-in-set?))
|
||||
#f)))
|
||||
|
||||
|
||||
;Called when the interrupt actually happened.
|
||||
;;; TODO w-i-i is problaly not necessary since they're off already
|
||||
(define (register-interrupt type)
|
||||
(let ((waiters (with-interrupts-inhibited
|
||||
(lambda ()
|
||||
(set-next-event! *most-recent-event* (make-event type))
|
||||
(set! *most-recent-event* (next-event *most-recent-event*))
|
||||
(do ((waiters '() (cons (dequeue-thread! event-thread-queue)
|
||||
waiters)))
|
||||
((thread-queue-empty? event-thread-queue)
|
||||
waiters))))))
|
||||
(for-each make-ready waiters)))
|
||||
|
||||
;;; has to be called with interrupts disabled
|
||||
(define (waiting-for-os-event?)
|
||||
(not (thread-queue-empty? event-thread-queue)))
|
||||
|
||||
(define (initialize-events!)
|
||||
(set! event-thread-queue (make-thread-queue))
|
||||
(set-interrupt-handler! (enum interrupt os-signal)
|
||||
(lambda (type arg enabled-interrupts)
|
||||
; type is already set in the unix signal handler
|
||||
(register-interrupt type)))
|
||||
(set-interrupt-handler! (enum interrupt keyboard)
|
||||
(lambda (enabled-interrupts)
|
||||
(register-interrupt (enum interrupt keyboard))))
|
||||
; (call-after-gc! (lambda () (register-interrupt (enum interrupt post-gc))))
|
||||
)
|
||||
;;; the vm uses the timer for the scheduler
|
||||
(define (schedule-timer-interrupt! msec)
|
||||
(spawn (lambda ()
|
||||
(sleep msec)
|
||||
(register-interrupt (enum interrupt alarm)))))
|
||||
|
Loading…
Reference in New Issue