Example #1
0
 def signal(self, semid=0):
     """
     signal(self, semid=0)
     
     PURPOSE: Specify a semaphore in the group to increase its value by
              one. This will allow one other thread or process to run if
              it is currently waiting on the semaphore.
     ARGS:    semid=0- the number of the semaphore in the group that you
                want to wait on.
     RETURN:  None
     """
     if 0 <= semid < self._sems:
         num, op, flg = tups2strings((semid, 1, SEM_UNDO))
         ipcmod.semop(self._sem_id, num, op, flg)
     else:
         raise ValueError, "semid out of range"
Example #2
0
 def signal(self, semid=0):
     """
     signal(self, semid=0)
     
     PURPOSE: Specify a semaphore in the group to increase its value by
              one. This will allow one other thread or process to run if
              it is currently waiting on the semaphore.
     ARGS:    semid=0- the number of the semaphore in the group that you
                want to wait on.
     RETURN:  None
     """
     if 0 <= semid <self._sems:
         num,op,flg = tups2strings((semid, 1 , SEM_UNDO))
         ipcmod.semop(self._sem_id, num,op,flg)
     else:
         raise ValueError, "semid out of range"
Example #3
0
 def wait(self, semid=0):
     """
     wait(self, semid=0)
     
     PURPOSE: Specify a semaphore in the group to reduce its value by one.
              If the semaphore value is already 0 or lower, then this 
              thread will wait until there have been enough signals to get
              the value back up to one. Note that this does not prevent 
              other python threads from running.
     ARGS:    semid=0- the number of the semaphore in the group that you
                want to wait on.
     RETURN:  None 
     """
     if 0 <= semid < self._sems:
         num, op, flg = tups2strings((semid, -1, SEM_UNDO))
         ipcmod.semop(self._sem_id, num, op, flg)
     else:
         raise ValueError, "semid out of range"
Example #4
0
 def wait(self, semid=0):
     """
     wait(self, semid=0)
     
     PURPOSE: Specify a semaphore in the group to reduce its value by one.
              If the semaphore value is already 0 or lower, then this 
              thread will wait until there have been enough signals to get
              the value back up to one. Note that this does not prevent 
              other python threads from running.
     ARGS:    semid=0- the number of the semaphore in the group that you
                want to wait on.
     RETURN:  None 
     """
     if 0 <= semid < self._sems:
         num, op, flg = tups2strings((semid, -1, SEM_UNDO))
         ipcmod.semop(self._sem_id, num,op,flg)
     else:
         raise ValueError, "semid out of range"