[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Threads in MingW gcc3.2
From: |
Jon Wilson |
Subject: |
Threads in MingW gcc3.2 |
Date: |
Mon, 10 Mar 2003 22:32:01 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130 |
I have the following code, none of the threads seem to do anything!
Have I misused the library? Each
cout << (new MyThread(i))->start() << endl;
prints 0.
Or could there be a bug?
Thanks.
Jon Wilson
#include <string>
#include <iostream>
#include <cc++/thread.h>
using namespace std;
using namespace ost;
class MyThread : public Thread{
public:
MyThread(int i){
this->i=i;
}
void run(){
cout << "RUNNING " << i << endl;
for(int j=0;j<100;j++){
cout << "Thread " << i << endl;
}
}
private:
int i;
};
int main(int argc,char **argv){
try{
for(int i=0;i<5;i++){
cout << "Thread " << i << " Starting " << (new
MyThread(i))->start() << endl;
}
}catch(string& s){
cout << "Error " << s << endl;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Threads in MingW gcc3.2,
Jon Wilson <=