title: Message queue using shared memory/semaphore, how to check if if there is no process connected to the queue?
body: <pre><code>typedef struct
  {
      char data[MESSAGE_SIZE];
  } MESSAGE;
  
  typedef struct
  {
      sem_t sem_send;
      sem_t sem_receive;
      MESSAGE messages[];
  } MQ;
  </code></pre>
  <p>Currently working on message queue, I want to delete the queue but in order to do so
  I need to destroy the semaphore (sem_destroy ) then shm_unlink
  but I need to be sure that there is no process currently connected to the queue</p>
  <p>How can I achieve this please ?</p>