new Threads and MultiThreads
-
I am trying to create a multi threaded program. First I have the thread that the program initializes, but I need another. The second thread is needed to access memory that is on a PCI card. I am already able to open the card, but not quite sure how to create a new thread. What include will I be needing? thanks, Steven
-
I am trying to create a multi threaded program. First I have the thread that the program initializes, but I need another. The second thread is needed to access memory that is on a PCI card. I am already able to open the card, but not quite sure how to create a new thread. What include will I be needing? thanks, Steven
That's quite simple! :) Try something like this: // ------------------------------------------------------ #include UINT threadID; unsigned WINAPI ThreadFunc(LPVOID param); void main() { CPCICard pPCICard = new CPCICard(); _beginthreadex(NULL,0,ThreadFunc,NULL /*that's the parameter for the ThreadFunc*/,0,&threadID); DoSomeWorkBlablabla(); delete pPCICard; } unsigned WINAPI ThreadFunc(LPVOID param) { DoSomeThreadWork(); RunningLoop(); return 0; } // --------------------------------------------------- I don't know whether I helped you or not, but when you call _beginthreadex the ThreadFunc function is called and then two threads running on the same time, doing different things. :) bond006