18 lines
378 B
C
18 lines
378 B
C
#include <pthread.h>
|
|
#include <stdio.h>
|
|
|
|
void *thread_func(void *data) {
|
|
printf("Hello from the new thread!\n");
|
|
return NULL;
|
|
}
|
|
|
|
int main() {
|
|
pthread_t thread;
|
|
int result = pthread_create(&thread, NULL, thread_func, NULL);
|
|
if (result != 0) {
|
|
printf("Error creating thread: %d\n", result);
|
|
return 1;
|
|
}
|
|
printf("Hello from the main thread!\n");
|
|
return 0;
|
|
}
|