I'm having trouble creating a thread within a thread. I need to create thread1 and thread1 does "something" as well as creating thread2 which will do something else.
my code:
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
void *msg1(void *ignored)
{
void *msg2(void *ignored)
{
printf("this is thread2");
}
pthread_t thread;
int thread2;
thread2 = pthread_create(&thread, NULL, msg2, NULL);
return 0;
}
int main ()
{
pthread_t thread;
int thread1;
thread1 = pthread_create(&thread, NULL, msg1, NULL);
return 1;
}