PDA

View Full Version : MultiThreading n Qhttp



Shambhavi
18th January 2006, 14:26
I am trying to simulate an environment where 'n' systems are simultaneously, sending 'x' requests each, to a server in my program

I am using Qhttp to send the 'x' requests to the server. This part is working fine perfectly.

Now in order to simulate 'n' systems sending these requests simultaneously I am using multithreading.

In main i have this


for(int i=0;i<noOfThreads;i++)
{
MyThread t(noOfLogs);
t.start();
}


and I have reimplemented run() of MyThread class to send the x requests.

The program is however crashing, where am I going wrong?

Codepoet
18th January 2006, 14:36
t is a local variable which is constructed at the beginning of the loop body and destroyed at the end of the body. Use a QList<MyThread*> to store the pointers you created in the loop with new.