Example #1
0
void *TGroup::read( ipstream& is )
{
    ushort index;

    TView::read( is );
    clip = getExtent();
    TGroup *ownerSave = owner;
    owner = this;
    last = 0;
    phase = TView::phFocused;
    current = 0;
    buffer = 0;
    lockFlag = 0;
    endState = 0;
    int count;
    is >> count;
    TView *tv;
    for( int i = 0; i < count; i++ )
        {
        is >> tv;
        if( tv != 0 )
            insertView( tv, 0 );
        }
    owner = ownerSave;
    TView *current;
    is >> index;
    current = at(index);
    setCurrent( current, TView::normalSelect );
    if (ownerGroup == NULL)
        awaken();
    return this;
}
Example #2
0
void PdalSession::initialize(
    const std::string& pipelineId,
    const std::string& filename,
    const bool serialCompress,
    const SerialPaths& serialPaths)
{
    m_initOnce.ensure([
                          this,
                          &pipelineId,
                          &filename,
                          serialCompress,
                          &serialPaths]()
    {
        m_pipelineId = pipelineId;
        m_filename = filename;
        m_serialCompress = serialCompress;
        std::cout << "Initializing " << pipelineId << " - " << filename <<
                  std::endl;

        // Try to awaken from serialized source.  If unsuccessful, initialize a
        // live source.
        if (!awaken(serialPaths) && !m_liveDataSource)
        {
            m_liveDataSource.reset(new LiveDataSource(pipelineId, filename));
            std::cout << "Created live source " << pipelineId << std::endl;
        }
    });
}
Example #3
0
int MprSelectService::insertHandler(MprSelectHandler *sp)
{
	if (list.getNumItems() == FD_SETSIZE) {
		mprLog(MPR_INFO, log, "Too many select handlers: %d\n", FD_SETSIZE);
		return MPR_ERR_TOO_MANY;
	}

	lock();

#if BLD_DEBUG
	MprSelectHandler	*np;
	np = (MprSelectHandler*) list.getFirst();
	while (np) {
		if (sp->fd == np->fd) {
			mprAssert(sp->fd != np->fd);
			break;
		}
		np = (MprSelectHandler*) list.getNext(np);
	}
#endif

	mprLog(8, log, "%d: insertHandler\n", sp->fd);
	list.insert(sp);
	listGeneration++;
	maskGeneration++;

	unlock();
	awaken();
	return 0;
}
Example #4
0
int MprSelectService::stop()
{
	int		i;

#if BLD_FEATURE_LOG
	mprLog(8, log, "stop()\n");
#endif

	awaken(0);

	//
	//	Clear out delayed close fds
	//
	lock();
	for (i = 0; i < maxDelayedFd; i++) {
		if (delayedFds[i] >= 0) {
			closesocket(delayedFds[i]);
			delayedFds[i] = -1;
		}
	}
	maxDelayedFd = 0;
	unlock();

	return 0;
}
Example #5
0
int MprSelectService::modifyHandler(MprSelectHandler *sp, bool wakeUp)
{
	lock();
	mprLog(8, log, "%d: modifyHandler\n", sp->fd);
	maskGeneration++;
	unlock();
	if (wakeUp) {
		awaken();
	}
	return 0;
}
Example #6
0
void MprSelectService::removeHandler(MprSelectHandler *sp)
{
	lock();
	mprLog(8, log, "%d: removeHandler\n", sp->fd);
	list.remove(sp);
	listGeneration++;
	maskGeneration++;
	rebuildMasks++;
	unlock();
	awaken();
}
Example #7
0
void Manifest::awakenAll(Pool& pool) const
{
    for (std::size_t i(0); i < m_fileInfo.size(); i += m_chunkSize)
    {
        pool.add([this, i]() { awaken(i); });
    }

    pool.cycle();

    if (std::any_of(
                m_remote.begin(),
                m_remote.end(),
                [](bool b) { return b; }))
    {
        throw std::runtime_error("Invalid remote manifest");
    }
}
Example #8
0
void AbstractThread::waitForClose()
{
	if (isActive())
	{
		if (isCurrentThread() == false)
		{
			// flag that we want the thread to terminate
			m_terminateRequested = true;
			awaken();

			// give the thread a chance to close on its own, and then
			// terminate anyway
			m_terminateEvent.wait(THREADJOIN_TIMEOUT);
		}

		terminate(false);
	}
}
Example #9
0
void PdalSession::serialize(const SerialPaths& serialPaths)
{
    if (m_initOnce.await()) throw std::runtime_error("Not initialized!");

    if (m_liveDataSource && !m_serialDataSource)
    {
        m_liveDataSource->serialize(m_serialCompress, serialPaths);
        std::cout << "Serialized - awakening " << m_pipelineId << std::endl;
        awaken(serialPaths);

        // TODO Safely clear the quadIndex from the live data source.  All its
        // pending READs must complete first - new ones (except for the custom
        // raster) will already be routed to the serial data source.
    }
    else if (m_serialDataSource)
    {
        std::cout << "Already serialized." << std::endl;
    }
}
Example #10
0
// start QD and scheduler
void BackEnd::barrier(void) {
  awaken();
  suspend();
}