happy-rusty
    Preparing search index...

    Interface RwLockReadGuard<T>

    A guard that provides shared read access to the RwLock-protected value.

    Multiple read guards can exist simultaneously, but no write guards can be acquired while any read guard is held.

    interface RwLockReadGuard<T> {
        "[toStringTag]": "RwLockReadGuard";
        value: T;
        toString(): string;
        unlock(): void;
    }

    Type Parameters

    • T

      The type of the protected value.

    Index

    Properties

    "[toStringTag]": "RwLockReadGuard"

    The well-known symbol Symbol.toStringTag used by Object.prototype.toString().

    value: T

    The protected value (read-only access).

    const guard = await rwlock.read();
    console.log(guard.value); // Read the value
    guard.unlock();

    Methods

    • Custom toString implementation.

      Returns string

      A string representation of the guard.

      const guard = await rwlock.read();
      console.log(guard.toString()); // 'RwLockReadGuard(42)'
    • Releases the read lock.

      After calling unlock(), the guard should not be used.

      Returns void

      const guard = await rwlock.read();
      try {
      console.log(guard.value);
      } finally {
      guard.unlock();
      }