本文整理汇总了C++中ThreadExists函数的典型用法代码示例。如果您正苦于以下问题:C++ ThreadExists函数的具体用法?C++ ThreadExists怎么用?C++ ThreadExists使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ThreadExists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
HRESULT
CPullPin::StopThread()
{
CAutoLock lock(&m_AccessLock);
if (!ThreadExists()) {
return S_FALSE;
}
// need to flush to ensure the thread is not blocked
// in WaitForNext
HRESULT hr = m_pReader->BeginFlush();
if (FAILED(hr)) {
return hr;
}
m_State = TM_Exit;
hr = CallWorker(TM_Exit);
m_pReader->EndFlush();
// wait for thread to completely exit
Close();
// decommit allocator
if (m_pAlloc) {
m_pAlloc->Decommit();
}
return S_OK;
}
示例2: locLock
STDMETHODIMP OggDemuxFilter::Pause()
{
CAutoLock locLock(m_pLock);
LOG(logDEBUG) << __FUNCTIONW__;
if (m_State == State_Stopped)
{
LOG(logDEBUG) <<L"Pause -- was stopped";
if (ThreadExists() == FALSE)
{
LOG(logDEBUG) << L"Pause -- CREATING THREAD";
Create();
}
LOG(logDEBUG) << L"Pause -- RUNNING THREAD";
CallWorker(THREAD_RUN);
}
HRESULT hr = CBaseFilter::Pause();
LOG(logDEBUG) << __FUNCTIONW__ << L"Base class returned: 0x" << std::hex << hr;
return hr;
}
示例3: lck
STDMETHODIMP CAMRSplitter::Pause()
{
CAutoLock lck(&lock_filter);
if (m_State == State_Stopped) {
ev_abort.Reset();
// activate pins
for (int i=0; i<output.GetCount(); i++) {
output[i]->Active();
}
if (input) {
input->Active();
}
// seekneme na danu poziciu
DoNewSeek();
// pustime parser thread
if (!ThreadExists()) {
Create();
CallWorker(CMD_RUN);
}
}
m_State = State_Paused;
return NOERROR;
}
示例4: FlushQueue
HRESULT CAMROutputPin::Active()
{
if (active) {
return NOERROR;
}
FlushQueue();
if (!IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
ev_abort.Reset();
HRESULT hr = CBaseOutputPin::Active();
if (FAILED(hr)) {
active = FALSE;
return hr;
}
// new segment
DoNewSegment(rtStart, rtStop, rate);
// vytvorime novu queue
if (!ThreadExists()) {
Create();
CallWorker(CMD_RUN);
}
active = TRUE;
return hr;
}
示例5: QueuePacket
HRESULT CLAVOutputPin::QueuePacket(Packet *pPacket)
{
if(!ThreadExists()) return S_FALSE;
CLAVSplitter *pSplitter = static_cast<CLAVSplitter*>(m_pFilter);
// While everything is good AND no pin is drying AND the queue is full .. sleep
// The queu has a "soft" limit of MAX_PACKETS_IN_QUEUE, and a hard limit of MAX_PACKETS_IN_QUEUE * 2
// That means, even if one pin is drying, we'll never exceed MAX_PACKETS_IN_QUEUE * 2
while(S_OK == m_hrDeliver
&& (m_queue.DataSize() > m_dwQueueMaxMem
|| m_queue.Size() > 2*m_dwQueueHigh
|| (m_queue.Size() > m_dwQueueHigh && !pSplitter->IsAnyPinDrying())))
Sleep(10);
if(S_OK != m_hrDeliver) {
SAFE_DELETE(pPacket);
return m_hrDeliver;
}
{
CAutoLock lock(&m_csMT);
if(m_newMT && pPacket) {
DbgLog((LOG_TRACE, 10, L"::QueuePacket() - Found new Media Type"));
pPacket->pmt = CreateMediaType(m_newMT);
SetStreamMediaType(m_newMT);
SAFE_DELETE(m_newMT);
}
}
m_Parser.Parse(m_StreamMT.subtype, pPacket);
return m_hrDeliver;
}
示例6: lock
BOOL
CAMThread::Create()
{
DWORD threadid;
CAutoLock lock(&m_AccessLock);
if (ThreadExists()) {
return FALSE;
}
m_hThread = CreateThread(
NULL,
0,
CAMThread::InitialThreadProc,
this,
0,
&threadid);
if (!m_hThread) {
return FALSE;
}
return TRUE;
}
示例7: lock
//
// Active
//
// The pin is active - start up the worker thread
HRESULT CSourceStream::Active(void) {
CAutoLock lock(m_pFilter->pStateLock());
HRESULT hr;
if (m_pFilter->IsActive()) {
return S_FALSE; // succeeded, but did not allocate resources (they already exist...)
}
// do nothing if not connected - its ok not to connect to
// all pins of a source filter
if (!IsConnected()) {
return NOERROR;
}
hr = CBaseOutputPin::Active();
if (FAILED(hr)) {
return hr;
}
ASSERT(!ThreadExists());
// start the thread
if (!Create()) {
return E_FAIL;
}
// Tell thread to initialize. If OnThreadCreate Fails, so does this.
hr = Init();
if (FAILED(hr))
return hr;
return Pause();
}
示例8: cAutoLock
HRESULT CBaseSplitterOutputPin::Inactive()
{
CAutoLock cAutoLock(m_pLock);
if(ThreadExists())
CallWorker(CMD_EXIT);
return __super::Inactive();
}
示例9: UpdateFromSeek
void mmSource::UpdateFromSeek()
{
if (ThreadExists())
{
DeliverBeginFlush();
Stop();
DeliverEndFlush();
Run();
}
}
示例10: DeliverEndFlush
HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
{
if(!ThreadExists()) return S_FALSE;
HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
m_hrDeliver = S_OK;
m_fFlushing = false;
m_fFlushed = true;
m_eEndFlush.Set();
return hr;
}
示例11: Inactive
HRESULT CTTASplitterInputPin::Inactive()
{
if (ThreadExists()) {
m_bAbort = TRUE;
CallWorker(CMD_EXIT);
Close();
}
return CBasePin::Inactive();
}
示例12: CallWorker
CAsyncUrlReader::~CAsyncUrlReader()
{
if (ThreadExists()) {
CallWorker(CMD_EXIT);
}
if (!m_fn.IsEmpty()) {
CMultiFiles::Close();
DeleteFile(m_fn);
}
}
示例13: Inactive
HRESULT CWavPackSplitterFilterInputPin::Inactive()
{
// Stop the thread
if (ThreadExists()) {
m_bAbort = TRUE;
CallWorker(CMD_EXIT);
Close();
}
return CBasePin::Inactive();
}
示例14: DeliverNewSegment
HRESULT CBaseSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
if(m_fFlushing) return S_FALSE;
m_rtStart = tStart;
if(!ThreadExists()) return S_FALSE;
HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
if(S_OK != hr) return hr;
MakeISCRHappy();
return hr;
}
示例15:
void my12doomImageStream::UpdateFromSeek()
{
if (ThreadExists())
{
DeliverBeginFlush();
// Shut down the thread and stop pushing data.
Stop();
DeliverEndFlush();
// Restart the thread and start pushing data again.
Pause();
}
}