Similarly: Delete all shared memory and semaphores on Linux , however I want to do this in C, not with a script.
My specific problem: in linux + mac, when I debug the program and finish it in the middle of the process, shared resources (memory + semaphores) are released. My program performs some actions with the client server, where the server is the first process to obtain shared resources. Therefore, after completion without disconnecting, when I restart the program, it assumes that it is a client when there is no server (since the resource was created and not released).
I am currently using Qt to manage shared resources, but Qt has no way to handle this situation (the error code that creates the return is that the resource has already been created). Therefore, I look at a more specific way to work with the OS. NOTE. Windows do not have this problem because the share is automatically freed upon completion.
source
share