(char rune)
| 130 | var Processing Processes |
| 131 | |
| 132 | func ProcessFile(char rune) { |
| 133 | process := &Process{} |
| 134 | process.Name = string(char) |
| 135 | |
| 136 | go func() { |
| 137 | defer process.Done() |
| 138 | |
| 139 | tick := time.NewTicker(time.Millisecond * time.Duration(rand.Intn(100)+100)) |
| 140 | defer tick.Stop() |
| 141 | |
| 142 | k := 0 |
| 143 | for range tick.C { |
| 144 | process.Update(k) |
| 145 | k++ |
| 146 | if rand.Intn(500) == 0 { |
| 147 | process.Fail(errors.New("we got a zeeero")) |
| 148 | return |
| 149 | } |
| 150 | } |
| 151 | }() |
| 152 | |
| 153 | Processing.Add(process) |
| 154 | } |
| 155 | |
| 156 | func main() { |
| 157 | go Listen() |