/* This package provides both high-level and low-level channel types for thread-safe communication. While channels are essentially thread-safe queues under the hood, their primary purpose is to facilitate safe communication between multiple readers and multiple writers. Although they can be used like queues, channels are designed with synchronization and concurrent messaging patterns in mind. Provided types: - `Chan` a high level channel - `Raw_Chan` a low level channel - `Raw_Queue` a low level non-threadsafe queue implementation used internally Example: import "core:sync/chan" import "core:fmt" import "core:thread" // The consumer reads from the channel until it's closed. // Closing the channel acts as a signal to stop. consumer :: proc(recv_chan: chan.Chan(int, .Recv)) { for { value, ok := chan.recv(recv_chan) if !ok { break // More idiomatic than return here } fmt.println("[CONSUMER] Received:", value) } fmt.println("[CONSUMER] Channel closed, stopping.") } // The producer sends `count` number of messages. producer :: proc(send_chan: chan.Chan(int, .Send), count: int) { for i in 0..