Semaphore blocking and signal handling

2000-11-21 Thread Vladimir Terziev
Hi. Am I right for the following: When a process is blocked on semop (trying to get resource) and receives a signal (for which the process has a handler), the process gets unblocked from the semop wait (to handle the signal), and after handling the signal continues with the instruction after sem

RE: Semaphore blocking and signal handling

2000-11-21 Thread Dmitry Dicky
Hi, easy: --- extern int errno; int sem_lock(int semnumb) { struct sembuf sb[2]; sb[0].sem_num = semnumb; sb[0].sem_op = -1; sb[0].sem_flg = 0; again: if( semop(sh->sem, sb,1) ) { errmsg("Semaphore %d erorr: %s\n",sh->sem, strerror(errno));