()
| 196 | private waiting: ((arg: any) => any)[] = [] |
| 197 | |
| 198 | private async lock() { |
| 199 | if (this.locked) { |
| 200 | await new Promise((complete) => { |
| 201 | if (!this.locked) { |
| 202 | this.locked = true |
| 203 | complete(null) |
| 204 | } else { |
| 205 | this.waiting.push(complete) |
| 206 | } |
| 207 | }) |
| 208 | } else { |
| 209 | this.locked = true |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | private unlock() { |
| 214 | let next = this.waiting.shift() |
no outgoing calls
no test coverage detected