23 lines
912 B
Racket
23 lines
912 B
Racket
|
#lang racket/base
|
||
|
|
||
|
;; this is necessary because our C embedding runtime doesn't flush the plumber by default
|
||
|
;; idk how to do it in C, therefore we do it in racket, just before exiting
|
||
|
;; we need to flush otherwise logs might get dropped, particularly those relating to the error
|
||
|
(define old-esc-handler (error-escape-handler))
|
||
|
(error-escape-handler (lambda ()
|
||
|
(plumber-flush-all (current-plumber))
|
||
|
(old-esc-handler)))
|
||
|
;; execute agent-main
|
||
|
; (require "../crossfire/agent.rkt")
|
||
|
; (agent-main)
|
||
|
(require "../crossfire/static-support.rkt")
|
||
|
(require ffi/unsafe)
|
||
|
(define _rktio (_cpointer 'rktio))
|
||
|
(define rktio-inst (get-ffi-obj/static "scheme_rktio" _rktio))
|
||
|
(define rktio-call (get-ffi-obj/static "rktio_processor_count" (_fun _rktio -> _int)))
|
||
|
|
||
|
(printf "num cpus: ~a\n" (rktio-call rktio-inst))
|
||
|
|
||
|
;; and if no error, also flush
|
||
|
(plumber-flush-all (current-plumber))
|