Supposing all the operation I can do is either:
- Inserting new element into an std::list (or)
- Reading the back() element of the list
Am I thread safe? Any thread can do any of the two operations in any order. I'm not expecting any specific order to see, for eg if I insert an element and then read the back() I am NOT expecting it to be the last one I just inserted, all I need is that the returned element shall be a valid one.
Can I safely do this without introducing an undefined behavior? Also I know I may need to use a concurrent queue, that's an option too I may consider, but this time I'm purely curious about this specific case with an std::list.