mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-30 04:07:55 +00:00
[std/channels]fix recv leaks(Part One) (#17394)
This commit is contained in:
@@ -89,6 +89,7 @@ proc runSuite(
|
||||
capacity(chan) == 1
|
||||
isBuffered(chan) == false
|
||||
isUnbuffered(chan) == true
|
||||
|
||||
else:
|
||||
chan = allocChannel(size = int.sizeof.int, n = 7)
|
||||
check:
|
||||
@@ -109,7 +110,7 @@ proc runSuite(
|
||||
discard pthread_join(threads[0], nil)
|
||||
discard pthread_join(threads[1], nil)
|
||||
|
||||
freeChannel(chan)
|
||||
freeChannel(chan)
|
||||
|
||||
# ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ var worker1: Thread[void]
|
||||
createThread(worker1, firstWorker)
|
||||
|
||||
# Block until the message arrives, then print it out.
|
||||
var dest = ""
|
||||
chan.recv(dest)
|
||||
let dest = chan.recv()
|
||||
doAssert dest == "Hello World!"
|
||||
|
||||
# Wait for the thread to exit before moving on to the next example.
|
||||
|
||||
Reference in New Issue
Block a user