当前位置: 首页>>代码示例>>C++>>正文


C++ LLFrameTimer::hasExpired方法代码示例

本文整理汇总了C++中LLFrameTimer::hasExpired方法的典型用法代码示例。如果您正苦于以下问题:C++ LLFrameTimer::hasExpired方法的具体用法?C++ LLFrameTimer::hasExpired怎么用?C++ LLFrameTimer::hasExpired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLFrameTimer的用法示例。


在下文中一共展示了LLFrameTimer::hasExpired方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clock

	void frametimer_object_t::test<3>()
	{
		clock_t t1 = clock();
		ms_sleep(200);
		clock_t t2 = clock();
		clock_t elapsed = t2 - t1 + 1;
		std::cout << "Note: using clock(), ms_sleep() actually took " << (long)elapsed << "ms" << std::endl;

		F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds();
		seconds_since_epoch += 2.0;
		LLFrameTimer timer;
		timer.setExpiryAt(seconds_since_epoch);
		/*
		 * Note that the ms_sleep(200) below is only guaranteed to return
		 * in 200ms _or_more_, so it should be true that by the 10th
		 * iteration we've gotten to the 2 seconds requested above
		 * and the timer should expire, but it can expire in fewer iterations
		 * if one or more of the ms_sleep calls takes longer.
		 * (as it did when we moved to Mac OS X 10.10)
		 */
		int iterations_until_expiration = 0;
		while ( !timer.hasExpired() )
		{
			ms_sleep(200);
			LLFrameTimer::updateFrameTime();
			iterations_until_expiration++;
		}
		ensure("timer took too long to expire", iterations_until_expiration <= 10);
	}
开发者ID:Belxjander,项目名称:Kirito,代码行数:29,代码来源:llframetimer_test.cpp

示例2:

	void frametimer_object_t::test<3>()
	{
		F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds();
		seconds_since_epoch += 2.0;
		LLFrameTimer timer;
		timer.setExpiryAt(seconds_since_epoch);
		ensure("timer not expired on create", !timer.hasExpired());
		int ii;
		for(ii = 0; ii < 10; ++ii)
		{
			ms_sleep(150);
			LLFrameTimer::updateFrameTime();			
		}
		ensure("timer not expired after a bit", !timer.hasExpired());
		for(ii = 0; ii < 10; ++ii)
		{
			ms_sleep(100);
			LLFrameTimer::updateFrameTime();			
		}
		ensure("timer expired", timer.hasExpired());
	}
开发者ID:Boy,项目名称:netbook,代码行数:21,代码来源:lltiming_tut.cpp

示例3: draw

void LLFloaterAvatarPicker::draw()
{
	// sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
	// lets check this via mOkButtonValidateSignal callback periodically.
	static LLFrameTimer timer;
	if (timer.hasExpired())
	{
		timer.setTimerExpirySec(0.33f); // three times per second should be enough.

		// simulate list changes.
		onList();
		timer.start();
	}

	LLFloater::draw();

// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e
	// TODO-RLVa: this code needs revisiting
	if (rlv_handler_t::isEnabled())
	{
		LLPanel* pNearMePanel = getChild<LLPanel>("NearMePanel");
		if ( (pNearMePanel) && (childGetVisibleTab("ResidentChooserTabs") == pNearMePanel) )
		{
			if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
			{
				if (mNearMeListComplete)
				{
					getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
					childSetEnabled("Select", false);
				}
				mNearMeListComplete = FALSE;
				pNearMePanel->setCtrlsEnabled(FALSE);
				return;
			}
			pNearMePanel->setCtrlsEnabled(TRUE);
		}
	}
// [/RLVa:KB]

	if (!mNearMeListComplete &&  getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel() == getChild<LLPanel>("NearMePanel"))
	{
		populateNearMe();
	}
}
开发者ID:aragornarda,项目名称:SingularityViewer,代码行数:44,代码来源:llfloateravatarpicker.cpp

示例4: draw

void LLFloaterAvatarPicker::draw()
{
	// sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
	// lets check this via mOkButtonValidateSignal callback periodically.
	static LLFrameTimer timer;
	if (timer.hasExpired())
	{
		timer.setTimerExpirySec(0.33f); // three times per second should be enough.

		// simulate list changes.
		onList();
		timer.start();
	}

	LLFloater::draw();
	if (!mNearMeListComplete && getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel() == getChild<LLPanel>("NearMePanel"))
	{
		populateNearMe();
	}
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:20,代码来源:llfloateravatarpicker.cpp

示例5: requestLock

bool LLPidLockFile::requestLock(LLNameTable<void *> *name_table, bool autosave,
								bool force_immediate, F32 timeout)
{
	bool readyToSave = FALSE;

	if (mSaving) return FALSE;	//Bail out if we're currently saving.  Will not queue another save.
	
	if (!mWaiting){
		mNameTable=name_table;
		mAutosave = autosave;
	}

	LLSD out_pids;
	out_pids.append( (LLSD::Integer)mPID );

	llifstream ifile(mLockName);

	if (ifile.is_open()) 
	{									//If file exists, we need to decide whether or not to continue.
		if ( force_immediate
			|| mTimer.hasExpired() )	//Only deserialize if we REALLY need to.
		{

			LLSD in_pids;

			LLSDSerialize::fromXML(in_pids, ifile);	

			//Clean up any dead PIDS that might be in there.
			for (LLSD::array_iterator i=in_pids.beginArray();
				i !=in_pids.endArray();
				++i)
			{
				U32 stored_pid=(*i).asInteger();

				if (isProcessAlive(stored_pid))
				{
					out_pids.append( (*i) );
				}
			}

			readyToSave=TRUE;
		}
		ifile.close();
	}
	else
	{
		readyToSave=TRUE;
	}

	if (!mWaiting)				//Not presently waiting to save.  Queue up.
	{
		mTimer.resetWithExpiry(timeout);
		mWaiting=TRUE;
	}

	if (readyToSave)
	{	//Potential race condition won't kill us. Ignore it.
		writeLockFile(out_pids);
		mSaving=TRUE;
	}
	
	return readyToSave;
}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:63,代码来源:llpidlock.cpp


注:本文中的LLFrameTimer::hasExpired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。