Re: [streams] WIP: exclusive reader interface (#251)

> +      return this._stream.read(...args);
> +    } finally {
> +      this._setReader(this._stream, this);
> +    }
> +  }
> +
> +  cancel(reason, ...args) {
> +    EnsureStreamReaderIsExclusive(this);
> +
> +    var stream = this._stream;
> +    this.releaseLock();
> +    return stream.cancel(reason, ...args);
> +  }
> +
> +  releaseLock() {
> +    this._setReader(this._stream, undefined);

We need check here, otherwise someone can release a lock with another already-released reader object.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/251/files#r21658101

Received on Thursday, 11 December 2014 04:57:22 UTC