Two questions: 1) What can I do with a thread descriptor? 2) Is there a way to get the thread descriptor from inside the thread?
There's no documentation that I can find on what a thread descriptor actually is or what can be done with it. It's an opaque structure...I guess I can use it for eq? and equal? comparisons, but I'm not sure what use that is. One thing I would like to be able to do with threads is give them a label for logging purposes. I've been making that work by creating a label when I create the thread and then parameterizing it into my 'say' macro (which I use in place of 'print' and etc): (define prefix-for-say (make-parameter "")) (define-syntax (say stx) (syntax-case stx () [(say a ...) #'(displayln (~a (prefix-for-say) a ...))] )) (parameterize ((prefix-for-say (label-maker))) (thread (thunk (say "about to do stuff") (do-stuff) (say "did stuff")))) This would print: "some-label: about to do stuff" "some-label: did stuff" -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.