Exemplo n.º 1
0
            /// 等待所有任务处理完成
            inline bool join_all(uint64_t milliseconds)
            {
                boost::timer bt;
                while ( unfinished() > 0 )
                {
                    if ((std::numeric_limits<uint64_t>::max)() != milliseconds
                        && bt.elapsed() * CLOCKS_PER_SEC > milliseconds)
                        return false;

                    sys_sleep(1);
                }

                return true;
            }
Exemplo n.º 2
0
void UpwardIterator::advance()
{
    do {
        _index--;

        if (_index < 0) {
            Term* parentTerm = _block->owningTerm;
            if (parentTerm == NULL) {
                _block = NULL;
                return;
            }

            _block = parentTerm->owningBlock;
            _index = parentTerm->index;

            if (_block == _stopAt)
                _block = NULL;
            if (_block == NULL)
                return;
        }
        
        // repeat until we find a non NULL term
    } while (unfinished() && current() == NULL);
}