Implement a channel (like the Golang primitive) that can be used for communicating between threads, such that all data sent will become available for receiving in the same order.
This channel is unbounded, so send should not block the calling thread indefinitely.
receive will block if no message is available in the channel until a new message is made available from a different thread.
The blocking wait should not waste CPU time on busy/spin wait.
这道题要求你实现一个支持线程间通信的无界 channel,行为类似 Golang 的 channel:发送的数据必须按先入先出的顺序被接收,发送端不能因为容量限制而长期阻塞,接收端在没有数据时需要进入真正的阻塞等待,而不是用 busy wait 空转消耗 CPU。常见做法是用线程安全队列保存消息,再配合互斥锁和条件变量 / 信号量来协调生产者与消费者;重点是保证顺序性、无界性,以及阻塞唤醒的正确性。