// Lock sets a lock for the given key. Acquired lock is only for the key in this dmap.
//
// It returns immediately if it acquires the lock for the given key. Otherwise, it waits until deadline.
//
// You should know that the locks are approximate, and only to be used for non-critical purposes.
Lock sets a lock for the given key. Acquired lock is only for the key in this dmap.

It returns immediately if it acquires the lock for the given key. Otherwise, it waits until deadline.

You should know that the locks are approximate, and only to be used for non-critical purposes.
// Lock sets a lock for the given key . Acquired lock is only for the key in this dmap . // // It returns immediately if it acquires the lock for the given key . Otherwise it waits until deadline . // // You should know that the locks are approximate and only to be used for non - critical purposes .
func (dm *DMap) Lock(key string, deadline time.Duration) (*LockContext, error) {
	ctx, err := dm.dm.Lock(key, deadline)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return &LockContext{ctx: ctx}, nil
}
func ( dm * DMap ) Lock ( key string , deadline time . Duration ) ( * LockContext , error ) { ctx , err := dm . dm . Lock ( key , deadline ) if err != nil { return nil , convertDMapError ( err ) } return & LockContext { ctx : ctx } , nil }
Lock sets a lock for the given key.
Lock sets a lock for the given key .