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

Method add_write_callback

lib_acl_cpp/src/stream/aio_ostream.cpp:96–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void aio_ostream::add_write_callback(aio_callback* callback)
97{
98 acl_assert(callback);
99
100 // �Ȳ�ѯ�ûص������Ѿ�����
101 std::list<AIO_CALLBACK*>::iterator it = write_callbacks_.begin();
102 for (; it != write_callbacks_.end(); ++it) {
103 if ((*it)->callback == callback) {
104 if ((*it)->enable == false) {
105 (*it)->enable = true;
106 }
107 return;
108 }
109 }
110
111 // ��һ����λ
112 it = write_callbacks_.begin();
113 for (; it != write_callbacks_.end(); ++it) {
114 if ((*it)->callback == NULL) {
115 (*it)->enable = true;
116 (*it)->callback = callback;
117 return;
118 }
119 }
120
121 // ����һ���µ�λ��
122 AIO_CALLBACK* ac = (AIO_CALLBACK*) acl_mycalloc(1, sizeof(AIO_CALLBACK));
123 ac->enable = true;
124 ac->callback = callback;
125
126 // ���ӽ��ص����������
127 write_callbacks_.push_back(ac);
128}
129
130int aio_ostream::del_write_callback(aio_callback* callback)
131{

Callers 15

handle_clientMethod · 0.80
open_writeMethod · 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

Calls 3

beginMethod · 0.80
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected