MCPcopy Create free account
hub / github.com/acl-dev/acl / add_read_callback

Method add_read_callback

lib_acl_cpp/src/stream/aio_istream.cpp:80–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void aio_istream::add_read_callback(aio_callback* callback)
81{
82 acl_assert(callback);
83
84 // �Ȳ�ѯ�ûص������Ѿ�����
85 std::list<AIO_CALLBACK*>::iterator it = read_callbacks_.begin();
86 for (; it != read_callbacks_.end(); ++it) {
87 if ((*it)->callback == callback) {
88 if ((*it)->enable == false) {
89 (*it)->enable = true;
90 }
91 return;
92 }
93 }
94
95 // ��һ����λ
96 it = read_callbacks_.begin();
97 for (; it != read_callbacks_.end(); ++it) {
98 if ((*it)->callback == NULL) {
99 (*it)->enable = true;
100 (*it)->callback = callback;
101 return;
102 }
103 }
104
105 // ����һ���µ�λ��
106 AIO_CALLBACK* ac = (AIO_CALLBACK*) acl_mycalloc(1, sizeof(AIO_CALLBACK));
107 ac->enable = true;
108 ac->callback = callback;
109
110 // ���ӽ��ص����������
111 read_callbacks_.push_back(ac);
112}
113
114int aio_istream::del_read_callback(aio_callback* callback /* = NULL */)
115{

Callers 15

handle_clientMethod · 0.80
accept_callbackMethod · 0.80
open_callbackMethod · 0.80
accept_callbackMethod · 0.80
open_callbackMethod · 0.80
accept_callbackMethod · 0.80
accept_callbackMethod · 0.80
startMethod · 0.80
open_callbackMethod · 0.80
handle_clientMethod · 0.80
accept_callbackMethod · 0.80
handle_clientMethod · 0.80

Calls 3

beginMethod · 0.80
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected