R
Ron Eggler
Hi,
I wanna use a mutex to make a class thread safe. I initialize it in its
constructor like:
GPIOcontrol::GPIOcontrol()
{//constructor
pthread_mutex_init(GPIO_mtx, NULL);//initializing the mutex
}
But my application just terminates after issueing thiss line. I'm using gcc
4.1.3
I have no clue what it's doing, GPIO-mtx is declared like this as a private
member of this class:
pthread_mutex_t *GPIO_mtx; // mutex declaration
The weird thing is now, it works just fine by declaring the member like:
pthread_mutex_t GPIO_mtx; // mutex declaration
and calling the mutex_init like:
pthread_mutex_init(&GPIO_mtx, NULL);//initializing the mutex
Why is this????
That's weirdin me out. Anyone an idea?
I wanna use a mutex to make a class thread safe. I initialize it in its
constructor like:
GPIOcontrol::GPIOcontrol()
{//constructor
pthread_mutex_init(GPIO_mtx, NULL);//initializing the mutex
}
But my application just terminates after issueing thiss line. I'm using gcc
4.1.3
I have no clue what it's doing, GPIO-mtx is declared like this as a private
member of this class:
pthread_mutex_t *GPIO_mtx; // mutex declaration
The weird thing is now, it works just fine by declaring the member like:
pthread_mutex_t GPIO_mtx; // mutex declaration
and calling the mutex_init like:
pthread_mutex_init(&GPIO_mtx, NULL);//initializing the mutex
Why is this????
That's weirdin me out. Anyone an idea?