Greetings!
I learnt little bit about multithreading, and tried to create a program with 2 threads. But the program won’t work. It seems like the thread function won’t execute. When I tried to debug into dirWatch(), the execution pointer doesn’t seems to enter the function. Though CreateThread() doesn’t return NULL and I don’t get any error messages. (I'm running this on WinXP)
Here what it looks like so far:
Code:
......
......
// Thread function
void WINAPI dirWatch(char dir[256]){
.......
.......
}
void main(){
........
........
........
lstrcpy(dir,temp);
// Create 1st thread
if(CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)dirWatch,dir,0,NULL)==NULL)
MessageBox(NULL,"CreateThread() failed.", "Message",0);
.........
.........
.........
lstrcpy(dir,temp);
// Create 2nd thread
if(CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)dirWatch,dir,0,NULL)==NULL)
MessageBox(NULL,"CreateThread() failed.", "Message",0);
.......
.......
}
What I’m doing wrong here please?
Thanks for reading.