fujuntang
2021-10-23 bae3a4fd9406635608edf0c0d16c52cf7ca06a66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __MSG_MGR_DEF_
#define __MSG_MGR_DEF_
 
#ifdef __cplusplus
extern "C" {
#endif 
 
#define SEM_TYPE_ID   0
#define RSV_TYPE_ID   1
 
#define MSG_TYPE_SEM  1
#define MSG_TYPE_RSV  2
 
#define SEM_CREATE    0
#define SEM_GET       1
#define SEM_POST      2
#define SEM_RM        3
#define SEM_RESET     4
 
#define MSG_PATH      "/tmp/msgqueue"
#define MSG_RSV_PATH  "/tmp/msgqueue_rsv"
 
#define QUERY_MUTEX_KEY 0x8700
 
#define MAX_LOCK      100
#define MAX_LOCK_HOLD 10
 
#define SEM_WT_TIMEOUT  60
 
typedef struct _msg_info
{
  long mtype;
  int key;
  int id;
  int act;
  int count;
 
} Msg_info;
 
#ifdef __cplusplus
}
#endif
 
int msg_init(void);
void msg_distrib(int msg_id, Msg_info *message);
int get_msg_info(int msg_id, Msg_info *message);
void *sem_msg_handler(void *skptr);
void msg_info_set(int index, Msg_info msg_obj);
 
#endif  //end of file