Implementing a synchronization barrier in Ruby

后端 未结 2 1838
死守一世寂寞
死守一世寂寞 2021-01-02 10:56

I\'m trying to \"replicate\" the behaviour of CUDA\'s __synchtreads() function in Ruby. Specifically, I have a set of N threads that need to execut

2条回答
  •  庸人自扰
    2021-01-02 11:35

    There might be merits of having the threads wait for each other. But I think that it is cleaner to have the threads actually finish at "midpoint", because your question obviously impliest that the threads need each others' results at the "midpoint". Clean design solution would be to let them finish, deliver the result of their work, and start a brand new set of threads based on these.

提交回复
热议问题