metarhia / metasync

Asynchronous Programming Library for JavaScript & Node.js
https://metarhia.com
MIT License
206 stars 35 forks source link

WIP: Web Locks API initial implementation #417

Open tshemsedinov opened 5 years ago

tshemsedinov commented 5 years ago

Refs: https://github.com/metarhia/metasync/issues/416

belochub commented 5 years ago

@tshemsedinov isn't it supposed to be compliant with the spec for Web Locks API? It defines two interfaces: LockManager and Lock, both of which are not present in the implementation in this PR. Thus I don't think it should be called 'Web Locks API implementation' unless you implement the interfaces mentioned above.

tshemsedinov commented 5 years ago

Yes, but it's just proof of concept and WIP. @belochub I'll implement also options: { mode: "exclusive" | "shared", signal <AbortSignal>, ifAvailable <boolean> } and extend specification with timeout, recursive locking and locking queue in each thread, error handling in critical section, etc.

tshemsedinov commented 4 years ago

In new implementation: