acquire method

Future<T> acquire(
  1. DspReg disposers
)

Implementation

Future<T> acquire(DspReg disposers) {
  final completer = Completer<T>();

  _queue.submit(() async {
    _logger.d('acquire task enter');

    final released = Completer();

    disposers.add(() => released.complete());

    completer.complete(_value);

    await released.future;

    _logger.d('acquire task exit');
  });

  return completer.future;
}