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

Method read_await

lib_acl_cpp/src/stream/aio_istream.cpp:283–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283void aio_istream::read_await(int count /* = 0 */, int timeout /* = 0 */,
284 acl_int64 delay /* = 0 */, aio_timer_reader* callback /* = NULL */)
285{
286 if (delay > 0) {
287 // �����µĻ����ö��ӳٶ�ʱ��
288
289 disable_read();
290
291 if (callback != NULL) {
292 if (timer_reader_ != NULL) {
293 handle_->del_timer(timer_reader_);
294 timer_reader_->destroy();
295 }
296 timer_reader_= callback;
297 }
298
299 if (timer_reader_ == NULL) {
300 timer_reader_ = NEW aio_timer_reader();
301 }
302 // ���� timer_reader_ ����ij�Ա����
303 timer_reader_->in_ = this;
304 timer_reader_->delay_gets_ = false;
305 timer_reader_->delay_timeout_ = timeout;
306 timer_reader_->delay_count_ = count;
307
308 // �����첽����ʱ��
309 handle_->set_timer(timer_reader_, delay);
310 return;
311 } else if (timer_reader_ != NULL) {
312 // ����ȡ��֮ǰ���õ��첽����ʱ��
313 handle_->del_timer(timer_reader_);
314 timer_reader_->destroy();
315 timer_reader_ = NULL;
316 }
317
318 // ���������첽����ʱʱ��
319 if (timeout >= 0) {
320 ACL_AIO_SET_TIMEOUT(stream_, timeout);
321 }
322 if (count > 0) {
323 acl_aio_readn(stream_, count);
324 } else {
325 acl_aio_read(stream_);
326 }
327}
328
329void aio_istream::readable_await(int timeout /* = 0 */)
330{

Callers

nothing calls this directly

Calls 6

acl_aio_readnFunction · 0.85
acl_aio_readFunction · 0.85
del_timerMethod · 0.80
set_timerMethod · 0.80
disable_readFunction · 0.50
destroyMethod · 0.45

Tested by

no test coverage detected