SEMAPHORE_P

Purpose

semaphore_p issues a P on a semaphore. 

Synopsis

#include <types.h> 
#include <stub.h> 

int semaphore_p(Capability *semaphore); 

Parameters

Description

semaphore_p issues a P operation on the semaphore designated by semaphore. The P operation decrements the semaphore's value and, if it becomes to 0, blocks the calling thread. 

A thread blocked on a semaphore is releases when the semaphore's value returns to a positive value because some thread issued a V operation on it. 

Return Values

On success, semaphore_p returns 0 and semaphore's value is decremented. 

On fail, semaphore_p returns a negative value indicating one of the following errors: 

See Also

semaphore_create, semaphore_destroy, semaphore_status, semaphore_v