0 Replies Latest reply: Mar 1, 2010 4:02 AM by 807559 RSS

    semaphore problem on Solaris

    807559
      I am using system V semaphore as named mutex on Solaris platform, I used semop to decrease count of semaphore when trying to lock. however, sometimes it takes very long (several minutes) to lock. it's very hard to reproduce the situation, it just happens occasionally. anyone has running into the same problem before? is it a bug? Thanks.

      My code to lock is as below. and The Solaris version I used is SunOS 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire-V250 Solaris
        struct sembuf op;
        op.sem_num = 0;
        op.sem_op  = -1;
        op.sem_flg = SEM_UNDO;
        int err;
        do
        {
             err = semop(_semid, &op, 1);
        }
        while (err && errno == EINTR);