Channel (programming)
In computing, a channel is a model for inter-thread communication and synchronization via message passing. A message may be sent over a channel, and another process or thread is able to receive messages sent over a channel it has a reference to, as a stream. Different implementations of channels may be buffered or not, and either synchronous or asynchronous.
In computing, a channel is a model for inter-thread communication and synchronization via message passing. A message may be sent over a channel, and another process or thread is able to receive messages sent over a channel it has a reference to, as a stream. Different implementations of channels may be buffered or not, and either synchronous or asynchronous. The Love2D library which uses the Lua programming language implements channels with push and pop operations similar to stacks. The pop operation will block so as long as there is data resident on the stack. A demand operation is equivalent to pop, except it will block until there is data on the stack -- A string containing code which will be interpreted by a function such as loadstring(), -- but on the C side to start a native thread. local threadCode = love.thread.getChannel("test"):push("Hello world!") function love.load() -- Start the thread. thread = love.thread.newThread(threadCode) thread:start() -- The thread will block until "Hello world!" is popped off channel test's stack. -- Because the channel can be popped from before the thread first executes, there may not be data on the stack. -- in that case use :demand() instead of :pop() because :demand() will block until there is data on the stack and then return the data. print(love.thread.getChannel("test"):demand()) -- The thread can now finish. end chan c; int x; par { c x; } c := make(chan int) go func() {c use std::sync::mpsc; use std::thread; fn main() { let (tx, rx) = mpsc::channel(); thread::spawn(move || { tx.send(123).unwrap(); }); let result = rx.recv(); println!("{:?}", result); }
References
No reference rows published for this article.
Cite this article
MLA
"Channel (programming)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/channel-programming. Accessed 24 November 2026.
Chicago
"Channel (programming)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/channel-programming.
APA
encyclopegia.org. (2026). Channel (programming). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/channel-programming
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON