spawn starts a new asynchronous operation on the writer. This method is used instead of starting goroutines inline to help manage the state of the writer's wait group. The wait group is used to block Close calls until all inflight operations have completed, therefore automatically including those st
(f func())
| 541 | // inflight operations have completed, therefore automatically including those |
| 542 | // started with calls to spawn. |
| 543 | func (w *Writer) spawn(f func()) { |
| 544 | w.group.Add(1) |
| 545 | go func() { |
| 546 | defer w.group.Done() |
| 547 | f() |
| 548 | }() |
| 549 | } |
| 550 | |
| 551 | // Close flushes pending writes, and waits for all writes to complete before |
| 552 | // returning. Calling Close also prevents new writes from being submitted to |
no test coverage detected