linux c
文章平均质量分 65
johnsonchengwu
这个作者很懒,什么都没留下…
展开
-
linux条件下打印错误编码
linux打印系统输出错误消息,linux系统内错误消息有133个,通过以下函数打印出来 函数名称error_list.c #include #include #include #define ERRNO 133 int main() { int i; for (i = 0; i < ERRNO; i++) { printf("%d %s\n",原创 2013-01-08 01:09:15 · 956 阅读 · 0 评论 -
linux c使用互斥锁实现同步
1. 需要使用到的库pthread.h 2. 需要使用到的函数有pthread_mutex_init, pthread_mutex_destory, pthread_mutex_lock, pthread_unlock, 3. 需要保护的数据结构为 typedef struct cnt_sum { int cnt; pthread_mutex_t _mutex; } cnt_su原创 2013-10-09 13:09:07 · 777 阅读 · 0 评论 -
linux c 线程设置detached状态
1. 需要用到的库 pthread_create pthread_attr_init pthread_attr_destory pthread_attr_setdetachstate 各个函数具体的用法可以查询google了解 2. 线程的分离状态和表述 在任何一个时间点上,线程是可结合的(joinable),或者是分离的(detached)。一个可结合的线程能够被其他线程收回其原创 2013-10-10 12:50:27 · 2833 阅读 · 0 评论 -
linux c pthread_mutex_lock和pthread_mutex_trylock对比
1. 需要用到的函数 pthread_mutex_lock phtread_mutex_trylock pthread_mutex_unlock原创 2013-10-10 13:14:54 · 2564 阅读 · 1 评论 -
c++实现List数据结构
1. 节点数据结构为: struct Node { void *data; Node *next; } *head; 2. list操作函数: bool add(void*); bool del(void*); bool insert(void*, void*); void traver原创 2013-10-14 12:40:54 · 779 阅读 · 0 评论