Hi people!!
I know this is short notice, but I've had this segmentation fault on a pthread_mutex_init (I'm almot 100% that's where it is), and I can't figure out why.
in a header.h, I have
Code:
typedef struct thread {
pthread_mutex_t lock;
int state;
int remaining_time;
struct thread * next;
} thread_data;
thread_data *OpSys,
*user1, *user2, *user3, *user4, *user5,
*MMU_data;
in my main, I have
Code:
pthread_mutex_init(OpSys->lock, NULL);
pthread_mutex_init(&user1->lock, NULL);
pthread_mutex_lock(&user1->lock);
pthread_mutex_init(&user2->lock, NULL);
pthread_mutex_lock(&user2->lock);
pthread_mutex_init(&user3->lock, NULL);
pthread_mutex_lock(&user3->lock);
pthread_mutex_init(&user4->lock, NULL);
pthread_mutex_lock(&user4->lock);
pthread_mutex_init(&user5->lock, NULL);
pthread_mutex_lock(&user5->lock);
pthread_mutex_init(&MMU_data->lock, NULL);
pthread_mutex_lock(&MMU_data->lock);
somewhere in that mess I get the seg fault... I'm not too good with pointers, and even though it compiles fine, I can't obviously run that.
Any suggestions???
Thanks