Thread and Queue

前端 未结 6 1452
情深已故
情深已故 2020-12-24 12:28

I am interested in knowing what would be the best way to implement a thread based queue.

For example:

I have 10 actions which I want to execute with only 4 t

6条回答
  •  -上瘾入骨i
    2020-12-24 13:04

    You could use a thread pool. It's a fairly common pattern for this type of problem.
    http://en.wikipedia.org/wiki/Thread_pool_pattern

    Github seems to have a few implementations you could try out:
    https://github.com/search?type=Everything&language=Ruby&q=thread+pool

提交回复
热议问题