()
| 15 | } |
| 16 | |
| 17 | release() { |
| 18 | if (this.active > 0) { |
| 19 | const next = this.queue.shift(); |
| 20 | if (next) { |
| 21 | next(); |
| 22 | return; |
| 23 | } |
| 24 | this.active--; |
| 25 | } else { |
| 26 | console.warn("Semaphore double release detected"); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | type TWithTimeoutNotifyResult<T> = { |