上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 75 下一页
摘要: 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 夜行过客 阅读(811) 评论(0) 推荐(0) 编辑
摘要: sem_tsem_initsem_waitsem_trywaitsem_timedwaitsem_postsem_destroy 生产者消费者实例: 阅读全文
posted @ 2018-01-11 15:30 夜行过客 阅读(4976) 评论(0) 推荐(0) 编辑
摘要: pthread_cond_tpthread_cond_initpthread_cond_destroypthread_cond_waitpthread_cond_timedwaitpthread_cond_signalpthread_cond_broadcast 生产者消费者模型: 运行结果: Pr 阅读全文
posted @ 2018-01-11 15:06 夜行过客 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 读共享,写独占 pthread_rwlock_tpthread_rwlock_initpthread_rwlock_destroypthread_rwlock_rdlockpthread_rwlock_wrlockpthread_rwlock_tryrdlockpthread_rwlock_tryw 阅读全文
posted @ 2018-01-11 14:13 夜行过客 阅读(3147) 评论(0) 推荐(0) 编辑
摘要: 问题描述: 我在终端中使用”dpkg -l”命令显示主机中安装的软件时,发现内容很多,而当命令执行完毕后,只显示终端最后一屏的内容。前面的都无法查看,这个是很让人憋屈的。下面就这一个问题说一下我的解决方法。 解决方法: 一、在执行命令的时候在后面加个”|more”,就如同我使用”dpkg –l|mo 阅读全文
posted @ 2018-01-11 14:01 夜行过客 阅读(8959) 评论(0) 推荐(0) 编辑
摘要: 互斥锁实例: #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 夜行过客 阅读(7652) 评论(0) 推荐(0) 编辑
摘要: #include <pthread.h>int pthread_detach(pthread_t tid); pthread_t tid: 分离线程的tid返回值:成功返回0,失败返回错误号。 一般情况下,线程终止后,其终止状态一直保留到其它线程调用pthread_join获取它的状态为止。但是线程 阅读全文
posted @ 2018-01-10 14:35 夜行过客 阅读(2189) 评论(0) 推荐(0) 编辑
摘要: 获取调用线程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 夜行过客 阅读(10145) 评论(0) 推荐(0) 编辑
摘要: 一. 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 夜行过客 阅读(3578) 评论(0) 推荐(0) 编辑
摘要: 最近在Ubuntu下编译一个程序,需要使用多线程库pthread,但是编译时总是提示“undefined reference to 'pthread_create'”的错误,如下图所示: 解决方法: gcc pthread.c -o app -lpthread 阅读全文
posted @ 2018-01-05 10:29 夜行过客 阅读(4016) 评论(0) 推荐(0) 编辑
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 75 下一页