view TaskManager/kernel/ppe/Sem.h @ 1531:4443d59a8210 draft

SDL.h in main.cc
author yuhi@cr.ie.u-ryukyu.ac.jp
date Fri, 07 Dec 2012 15:46:27 +0900
parents 4c209dd223cd
children f73ca57cdc81
line wrap: on
line source

#ifndef INCLUDED_SEM
#define INCLUDED_SEM

#include <pthread.h>

typedef struct sem_t {
	volatile int value;		//セマフォ変数
	pthread_mutex_t mutex;	//セマフォ操作用のロック
	pthread_cond_t cond;	//待ち合わせ用の条件変数
} sem_t, *sem_ptr;

class Sem {
public:
	/* constructor */
	Sem(int value);
	~Sem();
	void sem_p();
	void sem_v();
	int  count();
	/* variables */
private:
	sem_t *sem;
};

typedef Sem *SemPtr;

#endif /* INCLUDED_SEM */