acl
3.5.3.0
channel.hpp
浏览该文件的文档.
1
#pragma once
2
3
#include "
fiber_cpp_define.hpp
"
4
5
struct
ACL_CHANNEL
;
6
7
namespace
acl
{
8
9
ACL_CHANNEL
*
channel_create
(
int
elemsize,
int
bufsize);
10
void
channel_free
(
ACL_CHANNEL
*c);
11
int
channel_send
(
ACL_CHANNEL
*c,
void
*v);
12
int
channel_recv
(
ACL_CHANNEL
*c,
void
*v);
13
14
template
<
typename
T>
15
class
channel
16
{
17
public
:
18
channel
(
void
)
19
{
20
chan_ =
channel_create
(
sizeof
(T), 100);
21
}
22
23
~channel
(
void
)
24
{
25
channel_free
(chan_);
26
}
27
28
channel
&
operator <<
(T& t)
29
{
30
return
put
(t);
31
}
32
33
channel
&
put
(T& t)
34
{
35
channel_send
(chan_, &t);
36
return
*
this
;
37
}
38
39
void
pop
(T& t)
40
{
41
channel_recv
(chan_, &t);
42
}
43
44
private
:
45
ACL_CHANNEL
* chan_;
46
47
channel
(
const
channel
&);
48
void
operator=(
const
channel
&);
49
};
50
51
}
// namespace acl
acl::channel_send
int channel_send(ACL_CHANNEL *c, void *v)
acl::channel_free
void channel_free(ACL_CHANNEL *c)
acl::channel::put
channel & put(T &t)
Definition:
channel.hpp:33
ACL_CHANNEL
struct ACL_CHANNEL ACL_CHANNEL
Definition:
fiber_channel.h:15
fiber_cpp_define.hpp
acl::channel
Definition:
channel.hpp:15
acl::channel_recv
int channel_recv(ACL_CHANNEL *c, void *v)
acl
Definition:
acl_cpp_init.hpp:4
acl::channel::operator<<
channel & operator<<(T &t)
Definition:
channel.hpp:28
acl::channel_create
ACL_CHANNEL * channel_create(int elemsize, int bufsize)
acl::channel::channel
channel(void)
Definition:
channel.hpp:18
acl::channel::pop
void pop(T &t)
Definition:
channel.hpp:39
acl::channel::~channel
~channel(void)
Definition:
channel.hpp:23
include
fiber_cpp
fiber
channel.hpp
生成于 2021年 九月 10日 星期五 11:14:45 , 为 acl使用
1.8.15