#include #include #include #include void* thread_function(void* arg) { // 线程开始执行的函数 printf("Thread is running with argument: %s\n", (char*)arg); return NULL; } int main() { pthread_t thread_id; const char* message = "Hello, World!"; int result; // 创建线程 result = pthread_create(&thread_id, NULL, thread_function, (void*)message); if(result != 0) { perror("Thread creation failed"); exit(EXIT_FAILURE); } printf("Thread created successfully\n"); pthread_exit(NULL); // 等待线程结束 return 0; }