(define cpt2 (thread (lambda () (channel-put ch 'd))))
(printf "thread? ~a\n" (thread? cpt1))
(thread-send cpt1 5 #f)```
```thread? #t
thread-send: contract violation
expected: thread?
given: #0=(thread #1=(thread (thread #f #1# ...) #0# ...) (thread #0# #f ...) ...)
(define (thread-send thd v [fail-thunk
(lambda ()
(raise-mismatch-error 'thread-send "Thread ~a is not running.\n" thd))])
(check 'thread-send thread? thd)
@mflatt do you see a reason for this contract failure?
Is that the right thread?
in thread-send
? It’s easy to accidentally use a racket/base
binding when you mean to use a replacement from “thread.rkt”
@mflatt how would I tell if its the correct thread?
thread-send is just in thread.rkt
(define (thread-wait t)
(check 'thread-wait thread? t)
thread-wait does the same check
And it’s the right thread-send
in the (thread-send cpt1 5 #f)
? You could check with (identifier-binding thread-send)
good idea thanks
okay that fixed it thanks. needed to export function from main.rkt