Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._handle = undefined;
}
}
// #region AsyncLockable
[AsyncLockable.lock](cancelable?: Cancelable) {
return this.lock(cancelable);
}
[AsyncLockable.unlock]() {
this.unlock();
}
// #endregion AsyncLockable
}
const disposablePrototype: object = Object.getPrototypeOf(Disposable.create(() => {}));
const mutexLockHandlePrototype: object = {
[AsyncLockable.lock](this: LockHandle, cancelable?: Cancelable) {
return this.lock(cancelable);
},
[AsyncLockable.unlock](this: LockHandle) {
return this.unlock();
},
[Disposable.dispose](this: LockHandle) {
if (this.ownsLock) {
this.unlock();
}
}
};
defineTag(mutexLockHandlePrototype, "MutexLockHandle");
}
catch (e) {
// HostReportError(e);
setImmediate(() => { throw e; });
}
}
function isSignaled(signal: CancelSignal) {
return signal.signaled;
}
function canBeSignaled(signal: CancelSignal) {
return signal !== Cancelable.none && (!(signal instanceof CancelToken) || signal.canBeSignaled);
}
const disposablePrototype: object = Object.getPrototypeOf(Disposable.create(() => { }));
const cancelSourcePrototype: object = {
[Cancelable.cancelSignal](this: CancelSource) { return this.token; },
[CancelableSource.cancel](this: CancelSource) { this.cancel(); },
};
Object.setPrototypeOf(cancelSourcePrototype, disposablePrototype);
defineTag(cancelSourcePrototype, "CancelSource");
function createCancelSource(links: CancelLinks | undefined): CancelSource {
let state: "unsignaled" | "signaled" | "closed" = "unsignaled";
let token: CancelToken | undefined;
let subscriptions: LinkedList<() => void> | undefined;
const source: CancelSource = Object.setPrototypeOf({
get token() {
return token || (token = createCancelToken({
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { Tag, defineTag } from "@esfx/internal-tag";
import { WaitQueue } from "@esfx/async-waitqueue";
import { LockHandle, UpgradeableLockHandle, AsyncLockable } from "@esfx/async-lockable";
import { Cancelable } from "@esfx/cancelable";
import { Disposable } from "@esfx/disposable";
export { LockHandle, UpgradeableLockHandle } from "@esfx/async-lockable";
const disposablePrototype: object = Object.getPrototypeOf(Disposable.create(() => { }));
const lockHandlePrototype: object = {
get mutex() {
return this;
},
async [AsyncLockable.lock](this: LockHandle, cancelable?: Cancelable) {
await this.lock(cancelable);
return this;
},
[AsyncLockable.unlock](this: LockHandle) {
this.unlock();
},
[Disposable.dispose](this: LockHandle) {
if (this.ownsLock) {
this.unlock();
}
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { Disposable } from "@esfx/disposable";
import { isFunction, isMissing, isObject } from "@esfx/internal-guards";
import { defineTag } from "@esfx/internal-tag";
import { deprecateProperty } from "@esfx/internal-deprecate";
const disposablePrototype = Object.getPrototypeOf(Disposable.create(() => {}));
const cancelSubscriptionPrototype: Disposable = defineTag(Object.setPrototypeOf({
[Disposable.dispose](this: CancelSubscription) {
this.unsubscribe();
},
}, disposablePrototype), "CancelSubscription");
function createCancelSubscription(unsubscribe: () => void): CancelSubscription {
return Object.setPrototypeOf({
unsubscribe() {
unsubscribe();
},
}, cancelSubscriptionPrototype);
}
/**