To head off wrong answers: It's not thread cells. By themselves, they're not enough. Making them "preserved" also isn't the answer.

I'd like a thread-cell-like thing that gives each thread its own mutable vector. Here's why thread cells don't work:

#lang racket

(define v (make-thread-cell (vector 0 1)))
(sync (thread (λ () (vector-set! (thread-cell-ref v) 0 6))))
(thread-cell-ref v)


Output:

#<thread>
'#(6 1)


Clearly, both the created thread and the runtime thread access the same vector.

Not only do I need this, but I need repeated access to the per-thread vectors to be faster than allocating a new one. Ideally, after the first access, they'd allocate nothing.

Any ideas?

Neil ⊥
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to