How do I recover a semaphore when the process that decremented it to zero crashes?

后端 未结 8 572
轻奢々
轻奢々 2020-12-02 13:23

I have multiple apps compiled with g++, running in Ubuntu. I\'m using named semaphores to co-ordinate between different processes.

All works fine except in

8条回答
  •  感情败类
    2020-12-02 13:51

    Simply do a sem_unlink() immediately after the sem_open(). Linux will remove after all processes have closed the resource, which includes internal closes.

提交回复
热议问题