= 2; }); // each thread starts out with the initial value of 1, even though this thread already changed its copy of the thread local value to 2 let t = thread::spawn(move || { FOO.with(|f| { assert_eq!(*f.borrow(), 1); *f.borrow_mut() = 3; }); }); // wait for the thread to complete and bail out on panic t.join().unwrap(); // original thread retains the original value of 2 despite the child thread changing the value to 3 for that thread FOO.with(|f| { assert_eq!(*f.borrow(), 2); }); See also OpenMP Parallel processor support for certain hardware Shared memory Access to memory pages and configuration of (cpu and or kernel supported, if supported) Context switch Also called task switching, threads, pages are hardware accelerated and or kernel provided Semaphore (programming) LOCK, if (cpu) doesn't support multi-ported memory sufficiently (prevent cpu freeze) References External links ELF Handling For Thread-Local Storage — Document about an implementation in C or C++. ACE_TSS< TYPE > Class Template Reference RWTThreadLocal<Type> Class Template Documentation Article "Use thread-local Storage to Pass Thread Specific Data" by Doug Doedens "Thread-Local Storage" by Lawrence Crowl Article "It's Not Always Nice To Share" by Walter Bright Practical ThreadLocal usage in Java: http://www.captechconsulting.com/blogs/a-persistence-pattern-using-threadlocal-and-ejb-interceptors GCC "" Rust "" Threads (computing) Variable (computer science) Software design patterns