From 3c254528f2ed664dac06c6bbfb492af2beb73779 Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Wed, 24 Jul 2024 14:23:37 +0300 Subject: [PATCH] nil checks not needed and otherwise may indicate an issue with once --- threading/once.nim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/threading/once.nim b/threading/once.nim index ad4b173..f1468ba 100644 --- a/threading/once.nim +++ b/threading/once.nim @@ -35,8 +35,7 @@ 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" @@ -44,8 +43,7 @@ runnableExamples: 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]