I figured out how to work with them and what it all means.
But my program is giving me the following error
/tmp/ccejb4CZ.0(.text+0xcd): In function `main`:
: undefinded reference to `thread_function`
collect2: ld returned 1 exit status
in the beginning of my code I defined it as follows
void *thread_function(void *arg)
I use it in the following line
res = pthread_create(&a_thread, NULL, thread_function, NULL);
and again at the end of my code
int main()
{
}
void *thread_function(void *arg)
{
sem_wait(&bin_sem);
while(strncmp("end", work_area, 3) != 0)
{
printf("You input %d characters\n", strlen(work_area) -1);
sem_wait(&bin_sem);
}
Can someone please explain to me this error?
|