acl  3.5.3.0
fiber_channel.h
浏览该文件的文档.
1 #ifndef FIBER_CHANNEL_INCLUDE_H
2 #define FIBER_CHANNEL_INCLUDE_H
3 
4 #include "fiber_define.h"
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 /* channel communication */
11 
12 /**
13  * the fiber channel type definition
14  */
15 typedef struct ACL_CHANNEL ACL_CHANNEL;
16 
17 /**
18  * create one fiber channel
19  * @param elemsize {int} the fixed object size transfered in fiber channel
20  * @param bufsize {int} the buffered of objects in fiber channel
21  * @return {ACL_CHANNNEL*}
22  */
23 FIBER_API ACL_CHANNEL* acl_channel_create(int elemsize, int bufsize);
24 
25 /**
26  * free fiber channel created by acl_channel_create
27  * @param c {ACL_CHANNEL*} created by acl_channel_create
28  */
30 
31 /**
32  * send object to specified fiber channel in block mode
33  * @param c {ACL_CHANNEL*} created by acl_channel_create
34  * @param v {void*} the object to be transfered
35  * @return {int} value (>= 0) returned
36  */
37 FIBER_API int acl_channel_send(ACL_CHANNEL* c, void* v);
38 
39 /**
40  * send object to specified fiber channel in non-block mode, one new object
41  * copied from which will be created internal
42  * @param c {ACL_CHANNEL*} created by acl_channel_create
43  * @param v {void*} the object to be transfered
44  * @return {int} value (>= 0) returned
45  */
47 
48 /**
49  * read one object from specified channel in block mode
50  * @param c {ACL_CHANNEL*} created by acl_channel_create
51  * @param v {void*} will store the result
52  * @return {int} value(>= 0) returned if get one object
53  */
54 FIBER_API int acl_channel_recv(ACL_CHANNEL* c, void* v);
55 
56 /**
57  * read one object from specified channel in non-block ode
58  * @param c {ACL_CHANNEL*} created by acl_channel_create
59  * @param v {void*} will store the result
60  * @return {int} value(>= 0) returned if get one object, or NULL returned if
61  * none object been got
62  */
64 
65 /**
66  * send object's addr to specified channel in block mode
67  * @param c {ACL_CHANNEL*} created by acl_channel_create
68  * @param v {void*} the addr of the object to be transfered
69  * @return {int} value (>= 0) returned
70  */
71 FIBER_API int acl_channel_sendp(ACL_CHANNEL* c, void* v);
72 
73 /**
74  * get object's addr from specified channel in block mode
75  * @param c {ACL_CHANNEL*} created by acl_channel_create
76  * @return {void*} non-NULL addr returned
77  */
79 
80 /**
81  * send the object's addr to specified channel in non-block mode
82  * @param c {ACL_CHANNEL*} created by acl_channel_create
83  * @param v {void*} the addr of the object to be transfered
84  * @return {int} value which is >= 0 returned
85  */
87 
88 /**
89  * get the object's addr form specified channel in non-block mode
90  * @param c {ACL_CHANNEL*} created by acl_channel_create
91  * @return {void*} * non-NULL returned when got one, or NULL returned
92  */
94 
95 /**
96  * send unsigned integer to specified channel in block mode
97  * @param c {ACL_CHANNEL*} created by acl_channel_create
98  * @param val {unsigned long} the integer to be sent
99  * @return {int} value (>= 0) returned
100  */
101 FIBER_API int acl_channel_sendul(ACL_CHANNEL* c, unsigned long val);
102 
103 /**
104  * get unsigned integer from specified channel in block mode
105  * @param c {ACL_CHANNEL*} created by acl_channel_create
106  * @return {unsigned long}
107  */
108 FIBER_API unsigned long acl_channel_recvul(ACL_CHANNEL* c);
109 
110 /**
111  * sent unsigned integer to specified channel in non-block mode
112  * @param c {ACL_CHANNEL*} created by acl_channel_create
113  * @param val {unsigned long} integer to be sent
114  * @return {int} value(>= 0) returned
115  */
116 FIBER_API int acl_channel_sendul_nb(ACL_CHANNEL* c, unsigned long val);
117 
118 /**
119  * get one unsigned integer from specified channel in non-block mode
120  * @param c {ACL_CHANNEL*} created by acl_channel_create
121  * @return {unsigned long}
122  */
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
FIBER_API void * acl_channel_recvp_nb(ACL_CHANNEL *c)
FIBER_API unsigned long acl_channel_recvul(ACL_CHANNEL *c)
FIBER_API int acl_channel_sendul(ACL_CHANNEL *c, unsigned long val)
struct ACL_CHANNEL ACL_CHANNEL
Definition: fiber_channel.h:15
#define FIBER_API
Definition: fiber_define.h:94
FIBER_API int acl_channel_sendp(ACL_CHANNEL *c, void *v)
FIBER_API void acl_channel_free(ACL_CHANNEL *c)
FIBER_API unsigned long acl_channel_recvul_nb(ACL_CHANNEL *c)
FIBER_API void * acl_channel_recvp(ACL_CHANNEL *c)
FIBER_API int acl_channel_send(ACL_CHANNEL *c, void *v)
FIBER_API int acl_channel_recv(ACL_CHANNEL *c, void *v)
FIBER_API int acl_channel_sendul_nb(ACL_CHANNEL *c, unsigned long val)
FIBER_API ACL_CHANNEL * acl_channel_create(int elemsize, int bufsize)
FIBER_API int acl_channel_sendp_nb(ACL_CHANNEL *c, void *v)
FIBER_API int acl_channel_send_nb(ACL_CHANNEL *c, void *v)
FIBER_API int acl_channel_recv_nb(ACL_CHANNEL *c, void *v)