LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

new (multi-)thread

Hallo,

I have now read many messages and help files about multithreating, but I don't understand one thing:

When I have to give an audiomessage out in my program, I want to start a multithread, which do this.
I don't know how to create /initialize that thread, perhaps how to programm it exactly.

the program should be like this:

int main (...)
{

...
Audiooutput();
...

}


int Audiooutput (void)
{
...
sndPlaySound(...);
...
}

How can I start the "Audiooutput()" as an multithread?

thx for your help
Florian
0 Kudos
Message 1 of 2
(2,945 Views)
1) In the main() or anywhere else, you schedule your thread function.
CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE,ThreadFunction, &dummy,NULL);
As long as you use the default values, you don't have to care about closing the treads, waiting for completion, etc...

2) Your thread function (running in a separate thread) calls Audiooutput().
int ThreadFunction(void *functionData)
{
...
CA_InitActiveXThreadStyleForCurrentThread(0,COINIT_APARTMENTTHREADED); //may be useful in some cases
...
Audiooutput()
return(0);
}


Regards,
0 Kudos
Message 2 of 2
(2,937 Views)