By itself an UnsafeCell shouldn't be used by multiple threads at the same time, but in your case you should impl Sync for Producer, the compiler is not doing any promise, you are. Like a Mutex, you tell the compiler that you handle the sync part manually.
You might want restrictions on T also.
1 Like