fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 25: Send a value to another thread
Idiom # 25: Send a value to another thread
See
programming-idioms.org
:
Code
Code input
chan := concur.Channel String # send "Alan" to Channel chan <- "Alan" # receive "Alan" from Channel <-chan
What are effects?
Runnable Example
Code input
ex25 is # to create an open channel that may # send an receive Strings chan := concur.Channel String _ := concur.Threads.env.spawn ()-> # receive "Alan" say "Hello, $(<-chan)" # blocks until chan is closed, we then receive nil _ := <-chan chan <- "Alan" chan.close # we must not send anything to a closed Channel! # this would result in a precondition failure # chan <- "Wake"
What are effects?
last changed: 2026-10-14
next: Idiom # 26: Create a 2-dimensional array