Code for R11: Thread Safety