You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
modulemainimportosimportstrconvimportcoroutinesas_fnmain() {
mutn:=10if os.args.len >1 {
n= strconv.atoi(os.args[1]) or { n }
}
mutch:= chan int{cap: 1}
gogenerate(ch)
for _ in0 .. n {
prime:=<-ch
println(prime)
ch_next:= chan int{cap: 1}
gofilter(ch, ch_next, prime)
ch= ch_next
}
}
fngenerate(ch chan int) {
muti:=2for {
ch <- i++
}
}
fnfilter(chin chan int, chout chan int, prime int) {
for {
i:=<-chin
if i % prime !=0 {
chout <- i
}
}
}
Expected Behavior
output:
2
3
5
7
11
13
17
19
23
29
Current Behavior
stuck
2
3
5
7
11
13
sometimes:
0x770355bb27fa: at ???: RUNTIME ERROR: division by zero
0x770355bb0056: by ???
0x770355baedb3: by ???
0x770355bae900: by ???
/tmp/v_1000/prime.01J6MGHPXB892MJFSAW0JTM9SC.tmp.c:33500: by main__main
/tmp/v_1000/prime.01J6MGHPXB892MJFSAW0JTM9SC.tmp.c:33711: by main
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.7 8ebc288
Environment details (OS name and version, etc.)
uname -a
Linux ubuntu-mac 6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Describe the bug
When I use
coroutine
andchannel
to calculate a number of primes. It stuck!!Reproduction Steps
execute:
LD_LIBRARY_PATH=/path/to/thirdparty/photon/ v -use-coroutines run prime.v
prime.v (modified from 1.v):
Expected Behavior
output:
Current Behavior
stuck
sometimes:
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.7 8ebc288
Environment details (OS name and version, etc.)
uname -a
photonwrapper.so from latest commit:
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: