T
takeshi honda
I'm trying to create a thread program according to this article.
http://www.codeproject.com/Articles/21114/Creating-a-C-Thread-Class
The sample code is a case that each thread processes easy quick tasks.
In this case I have no problem.
But I want two threads to do time consuming process such as recvfrom().
In this case threading program doesn't work well.
while(1){
thread1.Event(); // this is waiting recvfrom() return.
thread2.Event(); // this doesn't start until above process finishes.
}
I also tried ThreadTypeIntervalDriven as follows.
thread1.SetThreadType(ThreadTypeIntervalDriven,10);
thread2.SetThreadType(ThreadTypeIntervalDriven,10);
For some reason, this causes a crash of the program.
How can I create program which has two threads using recvfrom()?
http://www.codeproject.com/Articles/21114/Creating-a-C-Thread-Class
The sample code is a case that each thread processes easy quick tasks.
In this case I have no problem.
But I want two threads to do time consuming process such as recvfrom().
In this case threading program doesn't work well.
while(1){
thread1.Event(); // this is waiting recvfrom() return.
thread2.Event(); // this doesn't start until above process finishes.
}
I also tried ThreadTypeIntervalDriven as follows.
thread1.SetThreadType(ThreadTypeIntervalDriven,10);
thread2.SetThreadType(ThreadTypeIntervalDriven,10);
For some reason, this causes a crash of the program.
How can I create program which has two threads using recvfrom()?