cis-452-lab-6/semp.h

50 lines
1.2 KiB
C
Raw Normal View History

2021-02-22 02:22:37 +00:00
#ifndef LAB_SEMP_H
#define LAB_SEMP_H
/**************************************************************************
* Authors: Gary Fleming, Amber McCloughan
* Class: CIS452 - Operating Systems Concepts
* Professor: Dr. Greg Wolffe
* Date: 3/14/2019
*
* Library of functions for synchronization
* using semaphores. Includes the classic
* wait() and signal() functions, as well as
* functions for initializing and deleting
* semaphores.
*
* @see semp.c for function implementations.
***************************************************************************/
/**
* Initialize a semaphore. The ID for using the other
* functions should be returned by the function.
*
* @param value, the value to initialize the semaphore to.
*/
int semp_init(int value);
/**
* Attempts to wait on the semaphore. Subtracts 1 from
* the internal value of the semaphore.
*
* @param semId, the ID of the semaphore.
*/
int semp_wait(int semId);
/**
* Signals the semaphore. Adds 1 to the internal value
* of the semaphore.
*
* @param semId, the ID of the semaphore.
*/
int semp_signal(int semId);
/**
* Deletes the semaphore.
*
* @param semId, the ID of the semaphore.
*/
int semp_destroy(int semId);
#endif