1189
|
1 #ifndef INCLUDED_SEM_MAIL_MANAGER
|
|
2 #define INCLUDED_SEM_MAIL_MANAGER
|
|
3
|
|
4 #include <pthread.h>
|
|
5 #include "MailManager.h"
|
|
6 #include "types.h"
|
|
7 #include "Sem.h"
|
|
8
|
|
9 class SemMailManager : public MailManager {
|
|
10 public:
|
|
11 /* constructor */
|
|
12 SemMailManager(unsigned int qsize = 32) ;
|
|
13
|
|
14 ~SemMailManager();
|
|
15
|
|
16 /* functions */
|
|
17 void send(memaddr data);
|
|
18 memaddr recv();
|
|
19 int count();
|
|
20
|
|
21 private:
|
|
22 /* variables */
|
|
23 memaddr *queue;
|
|
24 SemPtr queue_remain;
|
|
25 SemPtr queue_count;
|
|
26 unsigned int size;
|
|
27 unsigned int read;
|
|
28 unsigned int write;
|
|
29 unsigned int mask;
|
|
30
|
|
31 void calc_mask(unsigned int qsize);
|
|
32 void extend();
|
|
33 } ;
|
|
34
|
|
35 typedef SemMailManager *SemMailManagerPtr;
|
|
36
|
|
37 #endif
|