What is a safe operation on a std::cell:UnsafeCell?

Question:What is a safe operation on a std::cell:UnsafeCell?

1.A &mut T reference is allowed. However it may not cpexists with any other references. and may be created only in single-threaded code.

2.UnsafeCell provides thread-safety. Therefore, creating &T references from multiple threads is safe.

3.The only safe operation is the .get() method, which returns only a raw pointer.

4.Non. UnsafeCell only allows code that would otherwise need unsafe blocks to be written in safe code.


Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!