Equivalent of C# lock in Java? -
equivalent of c# lock in java?
for example:
public int next() { lock (this) { return nextunsynchronized(); } }
how port c# method java?
public int next() { synchronized (this) { return nextunsynchronized(); } }
that's it. , next code better.
public synchronized int next() { return nextunsynchronized(); }
Comments
Post a Comment