IMapK, VLock Method (K)Hazelcast .Net Client Class Library
Acquires the lock for the specified key.

Namespace: Hazelcast.Core
Assembly: HazelcastClient3x (in HazelcastClient3x.dll) Version:

void Lock(
	K key


Type: K
key to lock.

Acquires the lock for the specified key.

If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.

Scope of the lock is this map only. Acquired lock is only for the key in this map.

Locks are re-entrant so if the key is locked N times then it should be unlocked N times before another thread can acquire it.


This method uses GetHashCode and Equals of binary form of the key, not the actual implementations of GetHashCode and Equals defined in key's class.
See Also