racket/collects/math/tests/bigfloat-custodian.rkt
Matthew Flatt 5d57f6e497 ffi/unsafe/custodian: fix weak-reference problem
Also fix a related problem in the `math' MPFR binding (which was
masked by the `ffi/unsafe/custodian' bug).
2012-12-11 09:30:15 -07:00

20 lines
648 B
Racket

#lang racket/base
;; Not crashing means success for this stress test:
(let loop ([i 0] [l null])
(unless (= i 100)
(displayln "next")
(let ([l (if (zero? (random 5))
(begin
(printf "shutdown\n")
(for-each custodian-shutdown-all l)
null)
l)])
(let ([c (make-custodian)])
(parameterize ([current-custodian c])
(for ([i (random 10)]) (thread (lambda () (sleep 10))))
(parameterize ([current-namespace (make-base-namespace)])
(dynamic-require `math/bigfloat #f)))
(loop (add1 i) (cons c l))))))