fix racket/gui/dynamic and add multi-instance checks

This commit is contained in:
Matthew Flatt 2010-07-14 12:58:33 -06:00
parent 8e5eedc130
commit fa3d9cdf28
2 changed files with 14 additions and 1 deletions

View File

@ -38,6 +38,15 @@
queue-quit-event)
;; ------------------------------------------------------------
;; This module must be instantiated only once:
(define-mz scheme_register_process_global (_fun _string _pointer -> _pointer))
(let ([v (scheme_register_process_global "GRacket-support-initialized"
(cast 1 _scheme _pointer))])
(when v
(error "cannot start GRacket a second time in the same process")))
;; ------------------------------------------------------------
;; Create a Scheme evt that is ready when a queue is nonempty

View File

@ -6,8 +6,12 @@
(define (gui-available?)
(and (zero? (variable-reference->phase (#%variable-reference)))
(with-handlers ([exn:fail? (lambda (exn) #f)])
;; Fails if mred/private/dynamic is not instantiated:
;; Fails if `mred/private/dynamic' is not declared
;; (without loading it if not):
(module->language-info 'mred/private/dynamic #f)
;; Fails if `mred/private/dynamic' is not instantiated:
(module->namespace 'mred/private/dynamic)
;; Double check that it seems to have started ok:
(eq? (dynamic-require 'mred/private/dynamic 'kernel-initialized)
'done))))