/*******************************************************************************
 *	BSema.h		BSema Classes
 *			T.Barnaby,	BEAM Ltd,	6/11/02
 *	Copyright (c) 2012 All Right Reserved, Beam Ltd, http://www.beam.ltd.uk
 *******************************************************************************
 */
#ifndef BSEMA_H
#define BSEMA_H	1

#include <sys/types.h>
#include <semaphore.h>

/// Sempahore class
class BSema {
public:
			BSema(int value = 0);
			BSema(const BSema& sema);
			~BSema();
	
	int		post();				///< Post condition
	int		wait();				///< Wait for contition
	int		timedWait(int timeUs);		///< Wait for condition with timeout
	int		tryWait();			///< Test for the condition
	int		getValue() const;
	
	BSema&		operator=(const BSema& sema);
private:
	sem_t		osema;
};

#endif
