Inside the class I declared the thread function. I used static keyword because with out static keyword it is not working with class.
But if the type of the function is static I could not able to access the member function and public variables of the class
#include <iostream>
#include <pthread.h>
using namespace std;
class Base{
private:
    static  void * fpga_read(void*); // Thread function
    void foo_2();
public:
    /* member variables */
    void foo(void);
protected:
    int b;
};
void Base::foo(void)
{
    pthread_t id;
    pthread_create(&id, NULL,fpga_read,NULL);
    cout << "\nInside base class" << endl;
}
void * Base::fpga_read(void *p)
{
    cout << "\nInside thread function " << endl;
    // error: invalid use of member ‘Base::b’ in static member function
    cout << "Value of B inside thread class" << b;
    int b;
}
int main()
{
    Base a;
    a.foo();
    pthread_exit(NULL);
    return 0;
}
Any-body tell me how to use thread function with-out static keyword. so i can able to access all class variables.
 
     
     
    