Re: Thread program
Thank you everyone.
Unfortunately, I do program in severe environment where neither std::thread=
nor boost exists. I am not an admin of the server.
Do you have any idea for this solution?
2012=E5=B9=B411=E6=9C=883=E6=97=A5=E5=9C=9F=E6=9B=9C=E6=97=A5 22=E6=99=8251=
=E5=88=8625=E7=A7' UTC+9 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()?