会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
夜行过客
纸上得来终觉浅,绝知此事要躬行。
博客园
首页
新随笔
管理
上一页
1
···
39
40
41
42
43
44
45
46
47
···
75
下一页
2018年1月15日
Socket相关函数(1)- socket(), bind(), listen(), accept(), connect(), TCP模型
摘要: tcp_server.c tcp_client.c 运行: Client: ./client appResponse from server:APP Server: received from 127.0.0.1 at PORT 48041
阅读全文
posted @ 2018-01-15 14:04 夜行过客
阅读(842)
评论(0)
推荐(0)
2018年1月11日
线程相关函数(7)-sem_post(), sem_wait() 信号量
摘要: sem_tsem_initsem_waitsem_trywaitsem_timedwaitsem_postsem_destroy 生产者消费者实例:
阅读全文
posted @ 2018-01-11 15:30 夜行过客
阅读(5037)
评论(0)
推荐(0)
线程相关函数(6)-pthread_cond_wait(),pthread_cond_signal(), 条件变量
摘要: pthread_cond_tpthread_cond_initpthread_cond_destroypthread_cond_waitpthread_cond_timedwaitpthread_cond_signalpthread_cond_broadcast 生产者消费者模型: 运行结果: Pr
阅读全文
posted @ 2018-01-11 15:06 夜行过客
阅读(510)
评论(0)
推荐(0)
线程相关函数(5)-pthread_rwlock_rdlock(),pthread_rwlock_wrlock() 读写锁
摘要: 读共享,写独占 pthread_rwlock_tpthread_rwlock_initpthread_rwlock_destroypthread_rwlock_rdlockpthread_rwlock_wrlockpthread_rwlock_tryrdlockpthread_rwlock_tryw
阅读全文
posted @ 2018-01-11 14:13 夜行过客
阅读(3240)
评论(0)
推荐(0)
linux 终端 查看上一页
摘要: 问题描述: 我在终端中使用”dpkg -l”命令显示主机中安装的软件时,发现内容很多,而当命令执行完毕后,只显示终端最后一屏的内容。前面的都无法查看,这个是很让人憋屈的。下面就这一个问题说一下我的解决方法。 解决方法: 一、在执行命令的时候在后面加个”|more”,就如同我使用”dpkg –l|mo
阅读全文
posted @ 2018-01-11 14:01 夜行过客
阅读(9130)
评论(0)
推荐(0)
线程相关函数(4)-pthread_mutex_lock(), pthread_mutex_unlock() 互斥锁
摘要: 互斥锁实例: #include <pthread.h>pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;int pthread_mutex_destroy(pthread_mutex_t *mutex);int pthread_mutex_init(
阅读全文
posted @ 2018-01-11 10:50 夜行过客
阅读(7714)
评论(0)
推荐(0)
2018年1月10日
线程相关函数(3)-pthread_detach()将某个线程设成分离态
摘要: #include <pthread.h>int pthread_detach(pthread_t tid); pthread_t tid: 分离线程的tid返回值:成功返回0,失败返回错误号。 一般情况下,线程终止后,其终止状态一直保留到其它线程调用pthread_join获取它的状态为止。但是线程
阅读全文
posted @ 2018-01-10 14:35 夜行过客
阅读(2301)
评论(0)
推荐(0)
线程相关函数(2)-pthread_self()获取调用线程ID
摘要: 获取调用线程tid #include <pthread.h>pthread_t pthread_self(void); 示例: 运行结果: main thread: pid 4959 tid 9791296 (0x956740)new thread: pid 4959 tid 1480448 (0x
阅读全文
posted @ 2018-01-10 14:05 夜行过客
阅读(10468)
评论(0)
推荐(0)
线程相关函数(1)-pthread_create(), pthread_join(), pthread_exit(), pthread_cancel() 创建取消线程
摘要: 一. pthread_create() #include <pthread.h> int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg)
阅读全文
posted @ 2018-01-10 11:27 夜行过客
阅读(3914)
评论(0)
推荐(0)
2018年1月5日
ubuntu 下没有pthread库以及报undefined reference to 'pthread_create'的解决方法
摘要: 最近在Ubuntu下编译一个程序,需要使用多线程库pthread,但是编译时总是提示“undefined reference to 'pthread_create'”的错误,如下图所示: 解决方法: gcc pthread.c -o app -lpthread
阅读全文
posted @ 2018-01-05 10:29 夜行过客
阅读(4218)
评论(0)
推荐(0)
上一页
1
···
39
40
41
42
43
44
45
46
47
···
75
下一页
公告