How to Create two simultaneously running threads in VC++
|
Newbie Member
|
|
| 15Nov2006,09:52 | #1 |
|
Can anyone of me tell me how to create two threads in vc++, one thread should record the audio from microphone and copy to a buffer and the other should read from the buffer and play. These have to run simultaneously. There and be 10 buffers where the recorded data is copied, one played from a buffer the same can be used to record again.
|
|
Go4Expert Founder
|
![]() |
| 15Nov2006,11:22 | #2 |
|
The following code snippet does that
Code:
DWORD CPipeSampleDlg::CreatePipeThread()
{
DWORD dwThreadId = 0;
m_hPipeThread = ::CreateThread(0, 0, (LPTHREAD_START_ROUTINE)StartPipeThread, this, CREATE_SUSPENDED, &dwThreadId);
ASSERT(m_hPipeThread);
::SetThreadPriority(m_hPipeThread,THREAD_PRIORITY_IDLE);
if( !m_hPipeEvent )
m_hPipeEvent = ::CreateEvent( NULL, FALSE, FALSE, _T("StartUpdateDirectoryThread") );
else
::ResetEvent(m_hPipeEvent);
::ResumeThread(m_hPipeThread);
return dwThreadId;
}
|
|
Contributor
|
|
| 8Jan2007,18:08 | #3 |
|
Is this thread supposed to be in PROGRAMMING forums?
Correct me if i am wrong! |
|
Go4Expert Founder
|
![]() |
| 8Jan2007,18:22 | #4 |
|
Quote:
Originally Posted by evileye |

