2016年1月9日

摘要: 早就听说lock tables和unlock tables这两个命令,从字面也大体知道,前者的作用是锁定表,后者的作用是解除锁定。但是具体如何用,怎么用,不太清楚。今天详细研究了下,总算搞明白了2者的用法。 lock tables 命令是为当前线程锁定表.这里有2种类型的锁定,一种是读锁定,用命令 阅读全文
posted @ 2016-01-09 14:13 allen__ 阅读(2651) 评论(0) 推荐(1) 编辑

2015年12月5日

摘要: pointer to const object andconst pointer,1.指向常量对象的指针,意思是指针所指向的 对象内容不能变(不能够通过指针赋值)。2.常量指针,意思是指针内容不能变,指向对象a就不能改为指向对象b(指针不能指向别处)。(简单来说就是const挨着哪个近,哪个就不能变... 阅读全文
posted @ 2015-12-05 21:31 allen__ 阅读(461) 评论(0) 推荐(0) 编辑

2015年6月29日

摘要: 1、安装完debian后的第一件事就是找好源源文件地址:/etc/apt/sources.list(注意:linux的源要和linux系统的版本对应,拿debian来说,每个版本分为不稳定和稳定版,debian6的稳定版本名称叫:squeeze, debian7的稳定版本名称叫:wheezy , d... 阅读全文
posted @ 2015-06-29 21:28 allen__ 阅读(252) 评论(0) 推荐(0) 编辑

2015年4月29日

摘要: 所谓运算符重载,可以简单理解为函数的重载,而operator@就是函数名,@表示任何运算符,加减乘除等。#include using namespace std;class Complex{public: Complex(){real = 0; imag = 0;}; Complex(d... 阅读全文
posted @ 2015-04-29 23:08 allen__ 阅读(144) 评论(0) 推荐(0) 编辑

2015年4月16日

摘要: 先来看下普通的继承:class Instrument{public: void play() const{ coutplay(); //output: Instrument::play Wind* windObj = new Wind(); windOb... 阅读全文
posted @ 2015-04-16 11:34 allen__ 阅读(466) 评论(0) 推荐(0) 编辑

2015年4月14日

摘要: 把arrayB复制到arrayA中,strcpy的原型有两个版本,一个是操作数组,一个是操作指针数组版本:void myStrCpy(char* a, char* b){ int i = 0; while((a[i] = b[i]) != '\0'){ //(a[i] = b[... 阅读全文
posted @ 2015-04-14 16:50 allen__ 阅读(1300) 评论(0) 推荐(0) 编辑

2015年3月31日

摘要: #include #include #include "unistd.h"#include "assert.h"#include #include "sys/wait.h"#include pthread_t ntid;void printids(std::string s){ pid_t p... 阅读全文
posted @ 2015-03-31 00:09 allen__ 阅读(104) 评论(0) 推荐(0) 编辑

2015年3月29日

摘要: apue第十一章、十二章详细介绍线程。关于线程的头文件:#include 关于线程的函数:pthread_self() , //获取自己的线程IDpthread_create(), //创建新线程,参数自己去翻pthread_exit(), //结束线程pthread_join(), ... 阅读全文
posted @ 2015-03-29 23:29 allen__ 阅读(109) 评论(0) 推荐(0) 编辑
摘要: VC下堆和栈都有上限。一般堆的数据来自new出来的东西,这部分内存需要用户自己回收栈的数据一般是局部变量,系统会自行回收 阅读全文
posted @ 2015-03-29 23:29 allen__ 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 孤儿进程:一个父进程退出,而它的一个或多个子进程还在运行,那么那些子进程将成为孤儿进程。孤儿进程将被init进程(进程号为1)所收养,并由init进程对它们完成状态收集工作。 僵尸进程:一个进程使用fork创建子进程,如果子进程退出,而父进程并没有调用wait或waitpid获取子进程的状态信... 阅读全文
posted @ 2015-03-29 05:46 allen__ 阅读(428) 评论(0) 推荐(0) 编辑

导航