Skip to content

Instantly share code, notes, and snippets.

@soegaard
Created September 28, 2015 22:23
Show Gist options
  • Save soegaard/48b24d807dce40a1f226 to your computer and use it in GitHub Desktop.
Save soegaard/48b24d807dce40a1f226 to your computer and use it in GitHub Desktop.
#lang racket/gui
(let ([new-es (make-eventspace)])
(parameterize ([current-eventspace new-es])
(define frame (new frame%
[label "Bug demo"]))
(define button (new button%
[callback
(lambda _
(thread
(thunk
(channel-put result-chan (random)))))]
[label "FOOBAR"]
[parent frame]))
(define result-chan (make-channel))
(define (calling-me-should-get-a-number)
(send frame show #t)
(define toret (channel-get result-chan))
(send frame show #f)
toret)
(send frame show #t) ;; remove me and program doesn't start?!?!
(thread
(thunk
(let loop()
(displayln (calling-me-should-get-a-number))
;(sleep 1) ;; uncomment me and program dies after one iteration?!?!
(loop))))))
(sleep 100000000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment