1

This code keeps giving me a segmentation fault why?

view story
linux-howto

http://www.unix.com – Code: #include<stdlib.h> #include <pthread.h> #include "tlpi_hdr.h" #include <stdio.h> static volatile int glob = 0; static struct { pthread_t t1,t2; } *thread; static void *    /* Loop 'arg' times incrementing 'glob' */ threadFunc(void *arg) { int loops = *((int *) arg); int loc, j, s;   if (s != 0) errExitEN(s, "pthread_mutex_lock"); for (j = 0; j < loops; j++) { loc = glob; printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); printf("glob = %d\n", glob); (HowTos)