Future<void> lock({bool reentrant = false}) => synchronized(() { Completer<void> c = Completer(); _inLocks[identityHashCode(this)] = c; return c.future; });