-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locking timeout #24
base: master
Are you sure you want to change the base?
Locking timeout #24
Conversation
This PR should not contain commits not related to timeout. |
83bca61
to
b46ab15
Compare
Updated, ready for review, @tshemsedinov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need to use clearTimeout
on abort?
web-locks.js
Outdated
this.buffer = buffer ? buffer : new SharedArrayBuffer(4); | ||
this.flag = new Int32Array(this.buffer, 0, 1); | ||
if (!buffer) Atomics.store(this.flag, 0, UNLOCKED); | ||
} | ||
|
||
enter(handler) { | ||
enter(handler, timeout) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That it much better, but we need to compare passing timeout and timer instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need to use
clearTimeout
on abort?
Hmm, maybe it would be better to throw an error on timeout, similar to abort behavior?
Also, move all resolve / reject invocations to one place.
specify imported file extensions
You are doing good code but mixing multiple changes into one PR, we need to talk about process. |
if (timeout) | ||
timer = setTimeout(finalize, timeout, new TimeoutError('Time Out')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (timeout) | |
timer = setTimeout(finalize, timeout, new TimeoutError('Time Out')); | |
if (timeout) { | |
timer = setTimeout(finalize, timeout, new TimeoutError('Time Out')); | |
} |
Relates to #16