Use time.Sleep instead of time.After
This commit is contained in:
parent
12de3f78e0
commit
aa4c7f526f
|
@ -23,7 +23,7 @@ func SleepSortWithTimeout(a []int, timeout time.Duration) []int {
|
||||||
for _, val := range a {
|
for _, val := range a {
|
||||||
go func(val int) {
|
go func(val int) {
|
||||||
<-start
|
<-start
|
||||||
<-time.After(time.Duration(val) * time.Millisecond)
|
time.Sleep(time.Duration(val) * time.Millisecond)
|
||||||
results <- val
|
results <- val
|
||||||
}(val)
|
}(val)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue