Close stops the loop after finishing the execution of the current task. Other pending tasks will not be executed.
()
| 65 | // Close stops the loop after finishing the execution of the current task. |
| 66 | // Other pending tasks will not be executed. |
| 67 | func (l *Loop) Close() { |
| 68 | if err := l.Err(); err != nil { |
| 69 | return |
| 70 | } |
| 71 | |
| 72 | l.err.Store(ErrClosed) |
| 73 | |
| 74 | close(l.done) |
| 75 | <-l.taskLoopDone |
| 76 | } |
| 77 | |
| 78 | // Run serially executes the submitted callback. |
| 79 | // Blocking tasks must be cancelable by context. |