Beispiel #1
0
void MythSocketThread::WakeReadyReadThread(void) const
{
    if (!isRunning())
        return;

    QMutexLocker locker(&m_readyread_lock);
    m_readyread_wait.wakeAll();

    if (m_readyread_pipe[1] < 0)
        return;

    char buf[1] = { '0' };
    ssize_t wret = 0;
    while (wret <= 0)
    {
        wret = ::write(m_readyread_pipe[1], &buf, 1);
        if ((wret < 0) && (EAGAIN != errno) && (EINTR != errno))
        {
            VERBOSE(VB_IMPORTANT, "MythSocketThread, Error: "
                    "Failed to write to readyread pipe, closing pipe.");

            // Closing the pipe will cause the run loop's select to exit.
            // Then the next time through the loop we should fallback to
            // using the code for platforms that don't support pipes..
            CloseReadyReadPipe();
            break;
        }
    }
}
Beispiel #2
0
void MythSocketThread::ShutdownReadyReadThread(void)
{
    {
        QMutexLocker locker(&m_readyread_lock);
        m_readyread_run = false;
    }

    WakeReadyReadThread();

    wait(); // waits for thread to exit

    CloseReadyReadPipe();
}
Beispiel #3
0
void MythSocketThread::ShutdownReadyReadThread(void)
{
    {
        QMutexLocker locker(&m_readyread_lock);
        m_readyread_run = false;
    }

    WakeReadyReadThread();

    if (isRunning()) {
        quit(); // make the thread exit
        wait(); // waits for thread to exit
    }

    CloseReadyReadPipe();
}