My code works in most scenarios, but in this specific scenario, it does not at all do what I intend for it to do. I was hoping to have it reviewed and see if anyone could spot a fix.
Is this sort of question on-topic for Code Review?
Now, having answered your gut reaction on whether or not that sort of question should be on-topic, let's take a closer look at this question and see if it falls in that category:
Thread-safe (generic) value wrapper
The question itself states:
Please keep in mind that my goal is to provide full and fully safe access to the value, including any operation you might want to do with it, as conveniently as possible.
And that emphasis is of the asker's, not mine.
Then immediately, he states:
if the generic type is a reference type (a class, for instance), then
get()
is not thread safe anymore if methods called on the class change its contents or properties.
So, his code is thread safe... unless he's wrapping a reference type... in which case it's not thread safe.
The question was originally closed as broken code. Then, without the code changing at all, the plain-English part of the question changed. The word "problem" was changed to "issue" and the word "solve" was changed to "improve upon". And then re-opened.