MCPcopy Create free account
hub / github.com/Tencent/libco / TakeAllTimeout

Function TakeAllTimeout

co_routine.cpp:413–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411 return 0;
412}
413inline void TakeAllTimeout( stTimeout_t *apTimeout,unsigned long long allNow,stTimeoutItemLink_t *apResult )
414{
415 if( apTimeout->ullStart == 0 )
416 {
417 apTimeout->ullStart = allNow;
418 apTimeout->llStartIdx = 0;
419 }
420
421 if( allNow < apTimeout->ullStart )
422 {
423 return ;
424 }
425 int cnt = allNow - apTimeout->ullStart + 1;
426 if( cnt > apTimeout->iItemSize )
427 {
428 cnt = apTimeout->iItemSize;
429 }
430 if( cnt < 0 )
431 {
432 return;
433 }
434 for( int i = 0;i<cnt;i++)
435 {
436 int idx = ( apTimeout->llStartIdx + i) % apTimeout->iItemSize;
437 Join<stTimeoutItem_t,stTimeoutItemLink_t>( apResult,apTimeout->pItems + idx );
438 }
439 apTimeout->ullStart = allNow;
440 apTimeout->llStartIdx += cnt - 1;
441
442
443}
444static int CoRoutineFunc( stCoRoutine_t *co,void * )
445{
446 if( co->pfn )

Callers 1

co_eventloopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected