Re:Ruby core classes aren't thread safe
by danabramov on Monday February 25, 2013 @05:17PM
(#5282251)
If I understand correctly, this corresponds to `lock` in C#:
lock (_gate) {
x[i] --;
}
At least in C# it is considered preferable to lock on a private field, as opposed to locking on `this`, so nobody else also locks on your instance, potentially causing a deadlock.
I suppose this applies to `@synchronized` in Objective C as well.
I like that .NET Framework also provides some useful atomic methods, including this one:
I suppose this applies to `@synchronized` in Objective C as well.
I like that .NET Framework also provides some useful atomic methods, including this one:
They come in handy.