本文整理汇总了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);
}
示例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());
}
示例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();
}
}
示例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();
}
}
示例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;
}