Exemplo n.º 1
0
CPullPin::CPullPin()
  : m_pReader(NULL),
    m_pAlloc(NULL),
    m_State(TM_Exit)
{
#ifdef DXMPERF
	PERFLOG_CTOR( L"CPullPin", this );
#endif // DXMPERF

}
Exemplo n.º 2
0
CPullPin::CPullPin()
  : m_pReader(NULL),
    m_pAlloc(NULL),
    m_State(TM_Exit),
    m_tStart(0),
    m_tStop(0),
    m_tDuration(0),
    m_bSync(FALSE)
{
#ifdef DXMPERF
	PERFLOG_CTOR( L"CPullPin", this );
#endif // DXMPERF

}
Exemplo n.º 3
0
// A derived class may supply a hThreadEvent if it has its own thread that will take care
// of calling the schedulers Advise method.  (Refere to CBaseReferenceClock::AdviseThread()
// to see what such a thread has to do.)
CBaseReferenceClock::CBaseReferenceClock( __in_opt LPCTSTR pName, 
                                          __inout_opt LPUNKNOWN pUnk, 
                                          __inout HRESULT *phr, 
                                          __inout_opt CAMSchedule * pShed )
: CUnknown( pName, pUnk )
, m_rtLastGotTime(0)
, m_TimerResolution(0)
, m_bAbort( FALSE )
, m_pSchedule( pShed ? pShed : new CAMSchedule(CreateEvent(NULL, FALSE, FALSE, NULL)) )
, m_hThread(0)
{

#ifdef DXMPERF
    PERFLOG_CTOR( pName ? pName : L"CBaseReferenceClock", (IReferenceClock *) this );
#endif // DXMPERF

    ASSERT(m_pSchedule);
    if (!m_pSchedule)
    {
        *phr = E_OUTOFMEMORY;
    }
    else
    {
        // Set up the highest resolution timer we can manage
        TIMECAPS tc;
        m_TimerResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)))
                            ? tc.wPeriodMin
                            : 1;

        timeBeginPeriod(m_TimerResolution);

        /* Initialise our system times - the derived clock should set the right values */
        m_dwPrevSystemTime = timeGetTime();
        m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime;

        #ifdef PERF
            m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime"));
        #endif

        if ( !pShed )
        {
            DWORD ThreadID;
            m_hThread = ::CreateThread(NULL,                  // Security attributes
                                       (DWORD) 0,             // Initial stack size
                                       AdviseThreadFunction,  // Thread start address
                                       (LPVOID) this,         // Thread parameter
                                       (DWORD) 0,             // Creation flags
                                       &ThreadID);            // Thread identifier

            if (m_hThread)
            {
                SetThreadPriority( m_hThread, THREAD_PRIORITY_TIME_CRITICAL );
            }
            else
            {
                *phr = E_FAIL;
                EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
                delete m_pSchedule;
                m_pSchedule = NULL;
            }
        }
    }
}