-   
 
   wai_sem
  
    -   
  
 
 Acquire semaphore resource (waiting forever).
 
 ER      wai_sem (ID semid);
 
  
  
    | 
 | 
    
 | 
    
 | 
  
  
    | 
 | 
    
 ID      semid;
 
 | 
    
 ID number of the semaphore.
  
 | 
  
 
 This service call acquires a resource from the semaphore specified by parameter 
semid (subtracts 1 from the semaphore counter).
 
 If no resources are acquired from the target semaphore when this service call is issued (no available resources exist), this service call does not acquire resources but queues the invoking task to the target semaphore wait queue and moves it from the RUNNING state to the WAITING state (resource acquisition wait state).
 
 The WAITING state for a semaphore resource is cancelled in the following cases.
 
  
  
  
    
 WAITING State for a Semaphore Resource Cancel Operation
  
 | 
    
 | 
  
  
    
 The resource was released to the target semaphore as a result of issuing  sig_sem.
  
 | 
    
 | 
  
  
    
 The resource was released to the target semaphore as a result of issuing  isig_sem.
  
 | 
    
 | 
  
  
    
 Forced release from waiting (accept  rel_wai while waiting).
  
 | 
    
 | 
  
  
    
 Forced release from waiting (accept  irel_wai while waiting).
  
 | 
    
 | 
  
 
 Note	 Invoking tasks are queued to the target semaphore wait queue in the order defined during configuration (FIFO order or current priority order).
 
 
  
  
    | 
 | 
    
 | 
    
 | 
  
  
    | 
 | 
    
 | 
    
 | 
  
  
    | 
 | 
    
 | 
    
 | 
  
  
    | 
 | 
    
 | 
    
 -	 This service call was issued from a non-task.
  
 -	 This service call was issued in the CPU locked state.
  
 -	 This service call was issued in the dispatching disabled state.
  
 -	 This service call was issued in the status "PSW.IPL > kernel interrupt mask level".
  
 | 
  
  
    | 
 | 
    
 | 
    
 Forced release from the WAITING state.
  
 |