0

Possible Duplicate:
pthread Function from a Class

Can anyone give a simple example so I can understand how to use pthread in class?

The examples in Internet are so complicated that I don't get the concept.

I have written a code when not using class.

Edit:

I need to compile something like this:

#include<stdio.h>
#include<pthread.h>
using namespace std;
class test
{
private:
    int i = 0;
public:

static void *fun()
{
    i = i+1;
    cout << i<< endl;
}
};

int main()
{
pthread_t th;
test newTest;
pthread_create(&th, NULL, newTest.fun, NULL);
}
Community
  • 1
  • 1
Hamed JML
  • 249
  • 2
  • 11

0 Answers0