QQ网名大全

c语言怎么创建线程和使用

用 pthread_t创建线程名字。然后pthread_create开辟线程。
具体使用。
比如有一个函数
void *hello()
{
printf("create pthread!\n");

}
,然后在main函数里面调用,
int main()
{
pthread_t a_thread;
pthread_create(&a_thread, NULL, (void *)hello, NULL);
}

这样就完成了hello()函数的创建和使用,接下来hello函数就会在一个线程中运行
佚名
2024-05-31 15:55:23
最佳回答
类似问题(10)