0 Replies Latest reply: May 24, 2011 4:39 PM by 864157 RSS

    problem with SystemV semaphores

      I have a problem with synchronizing two processes with a named SysV semaphore. i am trying to build an auto-reset event between two processes. the idea is that one process always wait on 0 and the other proces wakes the other process by setting the semaphore to 0 and reseting it to 1 immidiatly. this is the code of the set method.

      sembuf sem;
      sem.sem_num =0;
      sem.sem_op = -1;
      sem.sem_flg = SEM_UNDO;
      int ret = semop(semID,&sem,1);
      if(ret == 0)
      sem.sem_op = 1;

      for some reason , the waitnig thread does not wake up unless i wait a considerable time befor the reset.
      the same code runs on Linux RH with no problems.

      what could be the problem ????