会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
navas
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
下一页
2016年9月18日
进程的初始堆栈
摘要:
阅读全文
posted @ 2016-09-18 15:38 navas
阅读(156)
评论(0)
推荐(0)
2016年9月17日
多线程 和 多进程
摘要: fork - create a child process#include <unistd.h>pid_t fork(void); exec系列。 int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict_a
阅读全文
posted @ 2016-09-17 20:44 navas
阅读(123)
评论(0)
推荐(0)
多线程的广播
摘要: 如果发出信号(pthread_cond_signal, pthread_cond_broadcast)时,没有线程在条件变量的wait 中等待,则这个信号丢失,其他线程走到wait时,投入睡眠状态。 对于本例子中,假设各线程必须要接收该信号(线程还没走到等待,主线程已经发送信号造成丢失),那么 应该
阅读全文
posted @ 2016-09-17 20:12 navas
阅读(1014)
评论(0)
推荐(0)
线程的条件变量
摘要: pthread_cond_wait时,需要传入条件变量和互斥变量,并且外围需要锁住和释放互斥锁。因为我们等待时判断的变量往往就是引起冲突的共享变量。
阅读全文
posted @ 2016-09-17 19:45 navas
阅读(166)
评论(0)
推荐(0)
2016年9月16日
线程特定数据
摘要: //pthread_key_create 使用&key pthread_setspecific pthread_getspecific 直接使用key(作为pkey的索引)//同一个key只能create一次(进程内),否则报22错误,invalid argument//pthread_once &
阅读全文
posted @ 2016-09-16 20:54 navas
阅读(313)
评论(0)
推荐(0)
2016年9月15日
指定抛异常类型
摘要: 1 #include 2 using namespace std; 3 4 void show() throw (int) 5 { 6 throw double(2); 7 } 8 9 int main() 10 { 11 try{ 12 show(); 13 } 14 catch (double eobj) 15 ...
阅读全文
posted @ 2016-09-15 17:34 navas
阅读(124)
评论(0)
推荐(0)
static和const
摘要:
阅读全文
posted @ 2016-09-15 17:10 navas
阅读(91)
评论(0)
推荐(0)
extern
摘要:
阅读全文
posted @ 2016-09-15 17:08 navas
阅读(112)
评论(0)
推荐(0)
2016年9月14日
struct,enum和uion
摘要: 三者用法相似,enum限定了取值范围,union更多作用应该是在以void*类型拷贝数据后,按内部类型做具体解析。
阅读全文
posted @ 2016-09-14 22:13 navas
阅读(182)
评论(0)
推荐(0)
字节对齐 pragma
摘要: 1 #include 21 #define KKK 22 #define TT 23 24 #pragma pack(2) //define to 2 25 struct test_t 26 { 27 int a; 28 char b; 29 short c; 30 char d; 31 }; 32 #pragma pack() ...
阅读全文
posted @ 2016-09-14 20:28 navas
阅读(226)
评论(0)
推荐(0)
上一页
1
2
3
下一页
公告