Skip to content

Commit

Permalink
nil checks not needed and otherwise may indicate an issue with once
Browse files Browse the repository at this point in the history
  • Loading branch information
planetis-m committed Jul 24, 2024
1 parent 0503676 commit 3c25452
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions threading/once.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ runnableExamples:
try:
for i in 1..1000:
let inst = getInstance()
if inst != nil:
assert inst.data == 1
assert inst.data == 1
except ValueError:
echo "Caught expected ValueError"

var threads: array[10, Thread[void]]
for i in 0..<10:
createThread(threads[i], worker)
joinThreads(threads)
if instance != nil:
deallocShared(instance)
deallocShared(instance)
echo "All threads completed"

import std / [locks, atomics]
Expand Down

0 comments on commit 3c25452

Please sign in to comment.