Is it possible to use Go's buffered channel as a thread-safe queue?

前端 未结 3 626
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-10 11:34

I want to find a queue structure (a data container) whose elements must be first-in-first-out. It is important for me that the structure must be thread-safe. I\'m going to u

3条回答
  •  猫巷女王i
    2020-12-10 12:14

    I'm pretty sure that Channels are FIFO. They are also cheap so they would be memory efficient. Beyond that without knowing the details of how you are going to use them We can't really give much more advice.

提交回复
热议问题