本文共 461 字,大约阅读时间需要 1 分钟。
分享一下我老师大神的人工智能教程!零基础,通俗易懂!
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
下面, 我们先看一个linux多线程程序:
#include在linux上执行gcc thread.c, 结果出现编译错误undefined reference to 'pthread_create'。由于pthread库不是标准linux库, 所以出错。 改为gcc thread.c -lpthread 即可。#include void* threadFunc(void* p){ while (1) { printf("a"); } return NULL;} int main (){ pthread_t id; pthread_create (&id, NULL, threadFunc, NULL); while (1) { printf("b"); } return 0;}