make tests green again
This commit is contained in:
parent
8b54db06cb
commit
aa526da706
3 changed files with 6 additions and 6 deletions
|
|
@ -164,8 +164,8 @@ proc terminate*[In, Out](a: var ActorPool[In, Out]) =
|
|||
## resources attached to `a`.
|
||||
var t: Task[In, Out]
|
||||
t.shutdown = true
|
||||
for i in 0.. <a.actors.len: send(a.actors[i].i, t)
|
||||
for i in 0.. <a.actors.len: join(a.actors[i])
|
||||
for i in 0..<a.actors.len: send(a.actors[i].i, t)
|
||||
for i in 0..<a.actors.len: join(a.actors[i])
|
||||
when Out isnot void:
|
||||
close(a.outputs)
|
||||
a.actors = nil
|
||||
|
|
|
|||
|
|
@ -207,9 +207,9 @@ when isMainModule:
|
|||
assert($deq == "[4, 56, 6, 789]")
|
||||
|
||||
assert deq[0] == deq.peekFirst and deq.peekFirst == 4
|
||||
assert deq[^1] == deq.peekLast and deq.peekLast == 789
|
||||
#assert deq[^1] == deq.peekLast and deq.peekLast == 789
|
||||
deq[0] = 42
|
||||
deq[^1] = 7
|
||||
deq[deq.len - 1] = 7
|
||||
|
||||
assert 6 in deq and 789 notin deq
|
||||
assert deq.find(6) >= 0
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ proc setup() =
|
|||
gCpus = p
|
||||
currentPoolSize = min(p, MaxThreadPoolSize)
|
||||
readyWorker = addr(workersData[0])
|
||||
for i in 0.. <currentPoolSize: activateWorkerThread(i)
|
||||
for i in 0..<currentPoolSize: activateWorkerThread(i)
|
||||
|
||||
proc preferSpawn*(): bool =
|
||||
## Use this proc to determine quickly if a 'spawn' or a direct call is
|
||||
|
|
@ -446,7 +446,7 @@ proc nimSpawn3(fn: WorkerProc; data: pointer) {.compilerProc.} =
|
|||
# implementation of 'spawn' that is used by the code generator.
|
||||
while true:
|
||||
if selectWorker(readyWorker, fn, data): return
|
||||
for i in 0.. <currentPoolSize:
|
||||
for i in 0..<currentPoolSize:
|
||||
if selectWorker(addr(workersData[i]), fn, data): return
|
||||
|
||||
# determine what to do, but keep in mind this is expensive too:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue