Windows Event implementation in Linux using conditional variables?

后端 未结 3 2008
星月不相逢
星月不相逢 2020-12-31 15:22

I am trying to implement very simple Windows events in Linux. Only for my scenario - 3 threads, 1 main and 2 secondary. Each of secondary threads raise 1 event by SetEvent a

3条回答
  •  鱼传尺愫
    2020-12-31 15:23

    I think semaphore is a better solution here, because it can be used inter-process. You can wrap the interface, if name is not provide, then use pthread_ to initialize it for intra-process to use, which can short the resource usage, but when name used, try to use sem initialize it, for intra-process use.

提交回复
热议问题