本文整理汇总了C++中RunEpilog函数的典型用法代码示例。如果您正苦于以下问题:C++ RunEpilog函数的具体用法?C++ RunEpilog怎么用?C++ RunEpilog使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RunEpilog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunProlog
void AlarmNotifyThread::run()
{
RunProlog();
while (!m_stop)
{
// get the alarm status for all monitors
if (ZMClient::get()->connected() && ZMClient::get()->updateAlarmStates())
{
// at least one monitor changed state
for (int x = 0; x < ZMClient::get()->getMonitorCount(); x++)
{
Monitor *mon = ZMClient::get()->getMonitorAt(x);
if (mon->previousState != mon->state && (mon->state == ALARM || (mon->state == ALERT && mon->previousState != ALARM)))
{
// have notifications been turned on for this monitor?
if (mon->showNotifications)
{
// we can't show a popup from the AlarmNotifyThread so send
// a message to ZMClient to do it for us
gCoreContext->dispatch(MythEvent(QString("ZONEMINDER_NOTIFICATION %1").arg(mon->id)));
}
}
}
}
usleep(999999);
}
RunEpilog();
}
示例2: RunProlog
void SSDP::run()
{
RunProlog();
fd_set read_set;
struct timeval timeout;
LOG(VB_UPNP, LOG_INFO, "SSDP::Run - SSDP Thread Started." );
// ----------------------------------------------------------------------
// Listen for new Requests
// ----------------------------------------------------------------------
while ( ! m_bTermRequested )
{
int nMaxSocket = 0;
FD_ZERO( &read_set );
for (uint nIdx = 0; nIdx < NumberOfSockets; nIdx++ )
{
if (m_Sockets[nIdx] != NULL && m_Sockets[nIdx]->socket() >= 0)
{
FD_SET( m_Sockets[ nIdx ]->socket(), &read_set );
nMaxSocket = max( m_Sockets[ nIdx ]->socket(), nMaxSocket );
#if 0
if (m_Sockets[ nIdx ]->bytesAvailable() > 0)
{
LOG(VB_GENERAL, LOG_DEBUG,
QString("Found Extra data before select: %1")
.arg(nIdx));
ProcessData( m_Sockets[ nIdx ] );
}
#endif
}
}
timeout.tv_sec = 1;
timeout.tv_usec = 0;
int count;
count = select(nMaxSocket + 1, &read_set, NULL, NULL, &timeout);
for (int nIdx = 0; count && nIdx < (int)NumberOfSockets; nIdx++ )
{
if (m_Sockets[nIdx] != NULL && m_Sockets[nIdx]->socket() >= 0 &&
FD_ISSET(m_Sockets[nIdx]->socket(), &read_set))
{
#if 0
LOG(VB_GENERAL, LOG_DEBUG, QString("FD_ISSET( %1 )").arg(nIdx));
#endif
ProcessData(m_Sockets[nIdx]);
count--;
}
}
}
RunEpilog();
}
示例3: RunProlog
void MetadataLoadingThread::run()
{
RunProlog();
//if you want to simulate a big music collection load
//sleep(3);
parent->resync();
RunEpilog();
}
示例4: RunProlog
void MythSystemSignalManager::run(void)
{
RunProlog();
LOG(VB_GENERAL, LOG_INFO, "Starting process signal handler");
while( run_system )
{
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 50 * 1000 * 1000; // 50ms
nanosleep(&ts, NULL); // sleep 50ms
while( run_system )
{
// handle cleanup and signalling for closed processes
listLock.lock();
if( msList.isEmpty() )
{
listLock.unlock();
break;
}
MythSystemUnix *ms = msList.takeFirst();
listLock.unlock();
// This can happen if it has been deleted already
if (!ms)
continue;
ms->m_parent->HandlePostRun();
if (ms->m_stdpipe[0] > 0)
writeThread->remove(ms->m_stdpipe[0]);
CLOSE(ms->m_stdpipe[0]);
if (ms->m_stdpipe[1] > 0)
readThread->remove(ms->m_stdpipe[1]);
CLOSE(ms->m_stdpipe[1]);
if (ms->m_stdpipe[2] > 0)
readThread->remove(ms->m_stdpipe[2]);
CLOSE(ms->m_stdpipe[2]);
if( ms->GetStatus() == GENERIC_EXIT_OK )
emit ms->finished();
else
emit ms->error(ms->GetStatus());
ms->disconnect();
bool cleanup = ms->m_parent->doAutoCleanup();
ms->Unlock();
if( cleanup )
ms->deleteLater();
}
}
RunEpilog();
}
示例5: RunProlog
// spawn separate thread for signals to prevent manager
void MythSystemLegacySignalManager::run(void)
{
RunProlog();
LOG(VB_GENERAL, LOG_INFO, "Starting process signal handler");
while( run_system )
{
usleep(50000); // sleep 50ms
while( run_system )
{
// handle cleanup and signalling for closed processes
listLock.lock();
if( msList.isEmpty() )
{
listLock.unlock();
break;
}
MythSystemLegacyWindows *ms = msList.takeFirst();
listLock.unlock();
if (!ms)
continue;
if (ms->m_parent)
{
ms->m_parent->HandlePostRun();
}
if (ms->m_stdpipe[0])
writeThread->remove(ms->m_stdpipe[0]);
CLOSE(ms->m_stdpipe[0]);
if (ms->m_stdpipe[1])
readThread->remove(ms->m_stdpipe[1]);
CLOSE(ms->m_stdpipe[1]);
if (ms->m_stdpipe[2])
readThread->remove(ms->m_stdpipe[2]);
CLOSE(ms->m_stdpipe[2]);
if (ms->m_parent)
{
if( ms->GetStatus() == GENERIC_EXIT_OK )
emit ms->finished();
else
emit ms->error(ms->GetStatus());
ms->disconnect();
ms->Unlock();
}
ms->DecrRef();
}
}
RunEpilog();
}
示例6: RunProlog
void FetcherThread::run(void)
{
RunProlog();
LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Starting Fetcher thread."));
if (m_dec)
m_dec->FetchFrames();
LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Stopping Fetcher thread."));
RunEpilog();
}
示例7: RunProlog
void PlaylistLoadingThread::run()
{
RunProlog();
while (!all_music->doneLoading())
{
msleep(250);
}
parent->load();
RunEpilog();
}
示例8: RunProlog
void DVBStreamHandler::run(void)
{
RunProlog();
LOG(VB_RECORD, LOG_INFO, LOC + "run(): begin");
if (!SupportsTSMonitoring() && _allow_section_reader)
RunSR();
else
RunTS();
LOG(VB_RECORD, LOG_INFO, LOC + "run(): end");
RunEpilog();
}
示例9: RunProlog
void GameScannerThread::run(void)
{
RunProlog();
LOG(VB_GENERAL, LOG_INFO, QString("Beginning Game Scan."));
m_files.clear();
m_remove.clear();
m_dbgames = RomInfo::GetAllRomInfo();
buildFileList();
verifyFiles();
updateDB();
RunEpilog();
}
示例10: RunProlog
void MythSignalingTimer::run(void)
{
running = true;
RunProlog();
while (dorun)
{
QMutexLocker locker(&startStopLock);
if (dorun && !timerWait.wait(locker.mutex(), millisec))
{
locker.unlock();
emit timeout();
locker.relock();
}
}
RunEpilog();
running = false;
}
示例11: RunProlog
/** \class HouseKeepingThread
* \ingroup housekeeper
* \brief Thread used to perform queued HouseKeeper tasks.
*
* This class is a long-running thread that pulls tasks out of the
* HouseKeeper queue and runs them sequentially. It performs one last check
* of the task to make sure something else in the same scope has not
* pre-empted it, before running the task.
*
*/
void HouseKeepingThread::run(void)
{
RunProlog();
m_waitMutex.lock();
HouseKeeperTask *task = NULL;
while (m_keepRunning)
{
m_idle = false;
while ((task = m_parent->GetQueuedTask()))
{
// pull task from housekeeper and process it
ReferenceLocker rlock(task);
if (!task->ConfirmRun())
{
// something else has caused the lastrun time to
// change since this was requested to run. abort.
task = NULL;
continue;
}
task->UpdateLastRun();
task->Run();
task = NULL;
if (!m_keepRunning)
// thread has been discarded, don't try to start another task
break;
}
m_idle = true;
if (!m_keepRunning)
// short out rather than potentially hitting another sleep cycle
break;
m_waitCondition.wait(&m_waitMutex);
}
m_waitMutex.unlock();
RunEpilog();
}
示例12: RunProlog
/// \brief Basic signal monitoring loop
void SignalMonitor::run(void)
{
RunProlog();
QMutexLocker locker(&startStopLock);
running = true;
startStopWait.wakeAll();
while (!exit)
{
locker.unlock();
UpdateValues();
if (notify_frontend && capturecardnum>=0)
{
QStringList slist = GetStatusList();
MythEvent me(QString("SIGNAL %1").arg(capturecardnum), slist);
gCoreContext->dispatch(me);
}
locker.relock();
startStopWait.wait(locker.mutex(), update_rate);
}
// We need to send a last informational message because a
// signal update may have come in while we were sleeping
// if we are using the multithreaded dtvsignalmonitor.
locker.unlock();
if (notify_frontend && capturecardnum>=0)
{
QStringList slist = GetStatusList();
MythEvent me(QString("SIGNAL %1").arg(capturecardnum), slist);
gCoreContext->dispatch(me);
}
locker.relock();
running = false;
startStopWait.wakeAll();
RunEpilog();
}
示例13: RunProlog
void TaskQueue::run( )
{
RunProlog();
Task *pTask;
LOG(VB_UPNP, LOG_INFO, "TaskQueue Thread Running.");
while ( !m_bTermRequested )
{
// ------------------------------------------------------------------
// Process Any Tasks that may need to be executed.
// ------------------------------------------------------------------
TaskTime ttNow;
gettimeofday( (&ttNow), nullptr );
if ((pTask = GetNextExpiredTask( ttNow )) != nullptr)
{
try
{
pTask->Execute( this );
pTask->DecrRef();
}
catch( ... )
{
LOG(VB_GENERAL, LOG_ERR, "Call to Execute threw an exception.");
}
}
// Make sure to throttle our processing.
msleep( 100 );
}
RunEpilog();
}
示例14: RunProlog
void HLSStreamHandler::run(void)
{
RunProlog();
int cnt = 0;
LOG(VB_GENERAL, LOG_INFO, LOC + "run() -- begin");
SetRunning(true, false, false);
if (!m_hls)
return;
m_hls->Throttle(false);
while (_running_desired)
{
if (!m_hls->IsOpen(m_tuning.GetURL(0).toString()))
{
if (!m_hls->Open(m_tuning.GetURL(0).toString()))
{
LOG(VB_CHANNEL, LOG_INFO, LOC +
"run: HLS OpenFile() failed");
usleep(500000);
continue;
}
m_hls->Throttle(true);
}
int size = m_hls->Read(m_buffer, BUFFER_SIZE);
if (size < 0)
{
// error
if (++cnt > 10)
{
Stop();
break;
}
continue;
}
else
cnt = 0;
if (size == 0)
{
usleep(250000); // .25 second
continue;
}
if (m_buffer[0] != 0x47)
{
LOG(VB_RECORD, LOG_INFO, LOC +
QString("Packet not starting with SYNC Byte (got 0x%1)")
.arg((char)m_buffer[0], 2, QLatin1Char('0')));
continue;
}
int remainder = 0;
{
QMutexLocker locker(&_listener_lock);
HLSStreamHandler::StreamDataList::const_iterator sit;
sit = _stream_data_list.begin();
for (; sit != _stream_data_list.end(); ++sit)
{
remainder = sit.key()->ProcessData(m_buffer, size);
}
}
if (remainder != 0)
{
LOG(VB_RECORD, LOG_INFO, LOC +
QString("data_length = %1 remainder = %2")
.arg(size).arg(remainder));
}
if (m_hls->IsThrottled())
usleep(1000000);
else if (size < BUFFER_SIZE)
usleep(100000); // tenth of a second.
else
usleep(1000);
}
m_hls->Throttle(false);
SetRunning(false, false, false);
RunEpilog();
LOG(VB_GENERAL, LOG_INFO, LOC + "run() -- done");
}
示例15: RunProlog
void MythSystemIOHandler::run(void)
{
RunProlog();
LOG(VB_GENERAL, LOG_INFO, QString("Starting IO manager (%1)")
.arg(m_read ? "read" : "write"));
m_pLock.lock();
BuildFDs();
m_pLock.unlock();
while( run_system )
{
{
QMutexLocker locker(&m_pWaitLock);
m_pWait.wait(&m_pWaitLock);
}
while( run_system )
{
usleep(10000); // ~100x per second, for ~3MBps throughput
m_pLock.lock();
if( m_pMap.isEmpty() )
{
m_pLock.unlock();
break;
}
timeval tv;
tv.tv_sec = 0; tv.tv_usec = 0;
int retval;
fd_set fds = m_fds;
if( m_read )
retval = select(m_maxfd+1, &fds, NULL, NULL, &tv);
else
retval = select(m_maxfd+1, NULL, &fds, NULL, &tv);
if( retval == -1 )
LOG(VB_SYSTEM, LOG_ERR,
QString("MythSystemIOHandler: select(%1, %2) failed: %3")
.arg(m_maxfd+1).arg(m_read).arg(strerror(errno)));
else if( retval > 0 )
{
PMap_t::iterator i, next;
for( i = m_pMap.begin(); i != m_pMap.end(); i = next )
{
next = i+1;
int fd = i.key();
if( FD_ISSET(fd, &fds) )
{
if( m_read )
HandleRead(i.key(), i.value());
else
HandleWrite(i.key(), i.value());
}
}
}
m_pLock.unlock();
}
}
RunEpilog();
}