码迷,mamicode.com
首页 >  
搜索关键字:pthread    ( 1177个结果
phread_con_wait和pthread_mutex_lock实现的生产者消费者模型
条件变量是利用线程间共享的全局变量进行同步的一种机制,主要包括两个动作:一个线程等待"条件变量的条件成立"而挂起;另一个线程使"条件成立"(给出条件成立信号)。为了防止竞争,条件变量的使用总是和一个互斥锁结合在一起。int pthread_cond_wait(pthread_cond_t *cond...
分类:其他好文   时间:2014-10-13 17:27:29    阅读次数:417
C++ async task
最近在搞Android 开发,里面多线程的使用比较频繁,java多线程接口很方便。 Thread, AysncTask, Handler 这些接口比起posix提供的pthread_create()等一系列接口方便很多,想到C++11也支持方便的多线程编程,最近java中AsyncTask用的比.....
分类:编程语言   时间:2014-10-12 22:37:08    阅读次数:290
linux环境下的线程的创建问题
pthread_create函数用于创建一个线程 函数原型 #include int pthread_create(pthread_t *restrict tidp,                 const pthread_attr_t *restrict attr,                 void *(*start_rtn)(void *),...
分类:编程语言   时间:2014-10-12 01:04:57    阅读次数:317
Android开发之Thread类分析 (转载)
转自:http://blog.csdn.net/llping2011/article/details/9706599 在我们Linux系统中创建线程函数为:pthread_create(),在Android中我们为线程封装了一个类Thread,实际调用的还是pthread_create()当我们.....
分类:移动开发   时间:2014-10-10 20:14:54    阅读次数:233
linux pthread pthread_create pthread_join pthread_detach
linux pthread pthread_create pthread_join pthread_detach
分类:系统相关   时间:2014-10-10 19:03:24    阅读次数:209
Linux组件封装之二:Condition
本博文讨论Linux中的条件变量Condition的封装;条件变量Condition 主要描述的是 线程间 的同步,即协作关系。Linux中的条件变量通常涉及以下几个函数:int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *...
分类:系统相关   时间:2014-10-06 23:40:40    阅读次数:377
【C/C++多线程编程之四】终止pthread线程
多线程编程之终止pthread线程 Pthread是 POSIX threads 的简称,是POSIX的线程标准。 终止线程似乎是多线程编程的最后一步,但绝不是本系列教材的结束。线程创建到线程终止,希望先给读者一个关于多线程编程的总体认识。 1.终止Pthread线程:pthrea...
分类:编程语言   时间:2014-10-06 22:56:20    阅读次数:179
Linux组件封装之一:MUtexLock
本文对pthread_mutex_t 进行简易的封装;互斥锁主要用于互斥,描述的是一种竞争关系,主要是一个 一种资源或者代码, 在一段时间内 至多能被一个程序访问。而条件变量主要用于线程间同步, 描述的是一种协作关系。Linux中互斥锁的应用比较简单,通用的有以下几个函数:1 int pthread...
分类:系统相关   时间:2014-10-06 22:44:20    阅读次数:241
Linux组件封装(一) 互斥锁MutexLock
由于pthread系列的函数都是成功时返回0,我们需要一段判断处理错误的代码:#define TINY_CHECK(exp)\ if(!exp)\ { \ fprintf(stderr, "File : %s, Line : %d Exp : ...
分类:系统相关   时间:2014-10-06 21:11:10    阅读次数:248
Linux组件封装(三)使用面向对象编程封装Thread
C++11提供了thread,但是过于复杂,我们还是倾向于在项目中编写自己的Thread。 Posix Thread的使用这里不再赘述。 重点是这个函数: #include int pthread_create(pthread_t *thread, const pthread_attr_t *att...
分类:系统相关   时间:2014-10-06 20:00:30    阅读次数:241
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!