Concurrency is extremely important in
our line of business and to that end, our interviewing process touches on that area quite often. When asking questions on basic synchronization, we've often been given the answer of "there's an attribute to do that". Unfortunately 100% of the candidates I've spoken to can never provide detail as to what this "Mysterious Method-locking Attribute" is. While reading through
this, it became clear:
[MethodImpl(MethodImplOptions.Synchronized)]
public void MyMethod()
{
}
Unfortunately, this uses lock(this) under the covers and would still be considered a multi-threading "fail", but at least I now know what people are talking about.