示例#1
0
void makeOperation(plst &head1,plst &head2)
{
	int a = front(head2);
	popNext(head2);
	int b = front(head2);
	popNext(head2);
	push(head2, counting(front(head1), a, b));
	popPrev(head1);
}
示例#2
0
// go to the next object. If no objects left, it falls out silently
// and waits to be killed by the window being closed.
BOOL LLFloaterScriptQueue::nextObject()
{
	S32 count;
	BOOL successful_start = FALSE;
	do
	{
		count = mObjectIDs.count();
		llinfos << "LLFloaterScriptQueue::nextObject() - " << count
				<< " objects left to process." << llendl;
		mCurrentObjectID.setNull();
		if(count > 0)
		{
			successful_start = popNext();
		}
		llinfos << "LLFloaterScriptQueue::nextObject() "
				<< (successful_start ? "successful" : "unsuccessful")
				<< llendl; 
	} while((mObjectIDs.count() > 0) && !successful_start);
	if(isDone() && !mDone)
	{
		
		LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");

		mDone = TRUE;
		std::string buffer = "Done."; // *TODO: Translate
		list->addCommentText(buffer);
		childSetEnabled("close",TRUE);
	}
	return successful_start;
}
示例#3
0
// go to the next object. If no objects left, it falls out silently
// and waits to be killed by the window being closed.
BOOL LLFloaterScriptQueue::nextObject()
{
	S32 count;
	BOOL successful_start = FALSE;
	do
	{
		count = mObjectIDs.count();
		llinfos << "LLFloaterScriptQueue::nextObject() - " << count
				<< " objects left to process." << llendl;
		mCurrentObjectID.setNull();
		if(count > 0)
		{
			successful_start = popNext();
		}
		llinfos << "LLFloaterScriptQueue::nextObject() "
				<< (successful_start ? "successful" : "unsuccessful")
				<< llendl; 
	} while((mObjectIDs.count() > 0) && !successful_start);
	if(isDone() && !mDone)
	{
		mDone = true;
		getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("Done"));
		getChildView("close")->setEnabled(TRUE);
	}
	return successful_start;
}
示例#4
0
/**
 * Fetch a particular type of message, blocking if one isn't available. 
 * @param type      The type of message to fetch
 * @param timeout   Maximum time to block, in seconds.
 *                  Actual resolution is system dependent 
 *                  A timeout of 0.0 indicates no timeout.
 * @return A message of the requested type.  Nul if the timeout elapses. 
 */
Message* Transport::waitNext(enum MessageTypes type, double timeout) 
{
    CHECK_THROW_CONFIGURED();

    double elapsed = 0.0;
    Message *msg;

    while( true ) {
        /* Check if the message has turned up 
         * Since we're blocking, not doing anything useful anyway, it doesn't
         * really matter that we're iterating the entire message queue every spin. */
        poll();
        msg = popNext(type);
        if( msg ) return msg;

        /* Check timeout */
        if( (timeout!=0.0) && (elapsed > timeout) ) {
            // If a timeout is set and has elapsed, fail out.
            return NULL;
        }

        // Wait a ms  before retry
        usleep(1000);
        elapsed += 0.001;
    }
}
示例#5
0
// go to the next object. If no objects left, it falls out silently
// and waits to be killed by the window being closed.
BOOL LLFloaterScriptQueue::nextObject()
{
	U32 count;
	BOOL successful_start = FALSE;
	do
	{
		count = mObjectIDs.size();
		LL_INFOS() << "LLFloaterScriptQueue::nextObject() - " << count
				<< " objects left to process." << LL_ENDL;
		mCurrentObjectID.setNull();
		if(count > 0)
		{
			successful_start = popNext();
		}
		LL_INFOS() << "LLFloaterScriptQueue::nextObject() "
				<< (successful_start ? "successful" : "unsuccessful")
				<< LL_ENDL; 
	} while((mObjectIDs.size() > 0) && !successful_start);
	if(isDone() && !mDone)
	{
		mDone = true;
		getChild<LLScrollListCtrl>("queue output")->addSimpleElement(getString("Done"), ADD_BOTTOM);
		getChildView("close")->setEnabled(TRUE);
	}
	return successful_start;
}
示例#6
0
// go to the next object. If no objects left, it falls out silently
// and waits to be killed by the window being closed.
BOOL LLFloaterBulkPermission::nextObject()
{
	S32 count;
	BOOL successful_start = FALSE;
	do
	{
		count = mObjectIDs.count();
		llinfos << "LLFloaterBulkPermission::nextObject() - " << count
				<< " objects left to process." << llendl;
		mCurrentObjectID.setNull();
		if(count > 0)
		{
			successful_start = popNext();
		}
		llinfos << "LLFloaterBulkPermission::nextObject() "
				<< (successful_start ? "successful" : "unsuccessful")
				<< llendl; 
	} while((mObjectIDs.count() > 0) && !successful_start);

	if(isDone() && !mDone)
	{
		
		LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
		mDone = TRUE;
		char buffer[MAX_STRING];		/*Flawfinder: ignore*/
		snprintf(buffer, sizeof(buffer), "Done.");				/* Flawfinder: ignore */
		list->addCommentText(buffer);

	}
	return successful_start;
}
示例#7
0
/**
 * Fetch a message, blocking if there are no messages currently available.
 * @param timeout   Maximum time to block, in seconds.
 *                  Actual resolution is system dependent 
 *                  A timeout of 0.0 indicates no timeout.
 * @return  A message.  Null if the timeout elapses. */
Message* Transport::waitNext(double timeout) 
{
    CHECK_THROW_CONFIGURED();

    double elapsed = 0.0;
    while( true ) {
        /* Return a message if it's turned up */
        poll();
        if( !rx_queue.empty() ) return popNext();

        /* Check timeout */
        if( (timeout!=0.0) && (elapsed > timeout) ) {
            // If we have a timeout set, and it has elapsed, exit.
            return NULL;
        }

        // Wait a ms before retry
        usleep(1000);
        elapsed += 0.001;
    }
}
// Go to the next object and start if found. Returns false if no objects left, true otherwise.
BOOL LLFloaterBulkPermission::nextObject()
{
	S32 count;
	BOOL successful_start = FALSE;
	do
	{
		count = mObjectIDs.count();
		//llinfos << "Objects left to process = " << count << llendl;
		mCurrentObjectID.setNull();
		if(count > 0)
		{
			successful_start = popNext();
			//llinfos << (successful_start ? "successful" : "unsuccessful") << llendl; 
		}
	} while((mObjectIDs.count() > 0) && !successful_start);

	if(isDone() && !mDone)
	{
		getChild<LLScrollListCtrl>("queue output")->addSimpleElement(getString("done_text"));
		mDone = TRUE;
	}
	return successful_start;
}
bool TexturesGenerator::threadLoop()
{
    // Check if we have any pending operations.
    mRequestedOperationsLock.lock();

    if (!m_deferredMode) {
        // if we aren't currently deferring work, wait for new work to arrive
        while (!mRequestedOperations.size())
            mRequestedOperationsCond.wait(mRequestedOperationsLock);
    } else {
        // if we only have deferred work, wait for better work, or a timeout
        mRequestedOperationsCond.waitRelative(mRequestedOperationsLock, gDeferNsecs);
    }

    mRequestedOperationsLock.unlock();

    bool stop = false;
    while (!stop) {
        QueuedOperation* currentOperation = 0;

        mRequestedOperationsLock.lock();
        ALOGV("threadLoop, %d operations in the queue", mRequestedOperations.size());

        if (mRequestedOperations.size())
            currentOperation = popNext();
        mRequestedOperationsLock.unlock();

        if (currentOperation) {
            ALOGV("threadLoop, painting the request with priority %d",
                  currentOperation->priority());
            // swap out the renderer if necessary
            BaseRenderer::swapRendererIfNeeded(m_renderer);

#ifdef PROFILE_TEXTURES_GENERATOR_MULTI_CORE
            bool profileWholeTxGenTime = static_cast<PaintTileOperation*>(currentOperation)->profileWholeTxGenTime();
            if (!profileWholeTxGenTime)
                static_cast<PaintTileOperation*>(currentOperation)->beginTime();
#endif
            currentOperation->run(m_renderer);
#ifdef PROFILE_TEXTURES_GENERATOR_MULTI_CORE
            if (!profileWholeTxGenTime)
                static_cast<PaintTileOperation*>(currentOperation)->endTime();
#endif
        }

        mRequestedOperationsLock.lock();
        if (m_deferredMode && !currentOperation)
            stop = true;
        if (!mRequestedOperations.size()) {
            m_deferredMode = false;
            stop = true;
        }
        mRequestedOperationsLock.unlock();

        if (currentOperation)
            delete currentOperation; // delete outside lock
    }
    ALOGV("threadLoop empty");

    return true;
}