上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 54 下一页
摘要: (1)删除包含特定字符的行:g/pattern/d(全局范围内):1,20g/pattern/d(删除1~20行内匹配的行)(2)删除不匹配的行:v/pattern/d:g!/pattern/d 阅读全文
posted @ 2013-05-01 21:06 robotke1 阅读(1701) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <unistd.h> 5 #include <semaphore.h> 6 #include <sys/types.h> 7 #include <dirent.h> 8 #include <pthread.h> 9 #include <errno.h>10 #include <signal.h>11 #include < 阅读全文
posted @ 2013-05-01 20:26 robotke1 阅读(764) 评论(0) 推荐(0)
摘要: (1)通过全局变量进行传递struct food{ int a; int b; int c;};struct food apple;void* task1(void* arg){ apple.a = 27; apple.b = 12; apple.c = 39; pthread_exit((void*)&apple);}int main(int argc, char *argv[]){ pthread_t thrd1, thrd2, thrd3; void* tret; pthread_create(&thrd1, NULL, (vo... 阅读全文
posted @ 2013-05-01 20:06 robotke1 阅读(486) 评论(0) 推荐(0)
摘要: 进程中的任一线程调用了exit,_Exit或者_exit,那么整个进程都会终止。 单个线程在不终止整个进程的情况下停止它的控制流,有三种方式:(1)线程只是从启动例程中返回,返回值是线程的退出码。(2)线程可以被同一进程中的其他线程取消。(3)线程调用pthread_exit。1、单个线程调用exit,_Exit或者_exitvoid* task1(void* arg){ while (1) {sleep(1);printf("thread1 running...\n");} return NULL;}void* task2(void *arg){ while (1) {s 阅读全文
posted @ 2013-05-01 18:25 robotke1 阅读(506) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <unistd.h> 5 #include <semaphore.h> 6 #include <sys/types.h> 7 #include <dirent.h> 8 #include <pthread.h> 9 #include <errno.h>10 #include <signal.h>11 #include < 阅读全文
posted @ 2013-05-01 15:48 robotke1 阅读(344) 评论(0) 推荐(0)
摘要: (转载)http://www.cnblogs.com/mydomain/archive/2011/08/14/2138454.html(2)线程的分离与结合(a) 在任何一个时间点上,线程是可结合的(joinable),或者是分离的(detached)。(b)一个可结合的线程能够被其他线程收回其资源和杀死;在被其他线程回收之前,它的存储器资源(如栈)是不释放的。(c)相反,一个分离的线程是不能被其他线程回收或杀死的,它的存储器资源在它终止时由系统自动释放。线程的分离状态决定一个线程以什么样的方式来终止自己。在上面的例子中,我们采用了线程的默认属性,即为非分离状态(即可结合的,joinable, 阅读全文
posted @ 2013-05-01 15:20 robotke1 阅读(174) 评论(0) 推荐(0)
摘要: (转载)http://blog.csdn.net/xinu2009/article/details/6768133信号量的数据类型为结构sem_t,它本质上是一个长整型的数。------函数sem_init()用来初始化一个信号量。 它的原型为: extern int sem_init __P ((sem_t *__sem, int __pshared, unsigned int __value));sem为指向信号量结构的一个指针;pshared不为0时此信号量在进程间共享,否则只能为当前进程的所有线程共享;value给出了信号量的初始值。-----函数sem_post( sem_t *se 阅读全文
posted @ 2013-05-01 14:36 robotke1 阅读(271) 评论(0) 推荐(0)
摘要: (转载)http://blog.chinaunix.net/uid-14966892-id-2780401.htmlHere is an answer from the "Frequently Asked Questions about the GNU C Library" (the FAQ):4.9. How can I find out which version of glibc I am using in the moment?{UD} If you want to find out about the version from the command line s 阅读全文
posted @ 2013-05-01 14:33 robotke1 阅读(444) 评论(0) 推荐(0)
摘要: 民间俗语云:早上吃姜,胜过吃参汤;晚上吃姜,等于吃砒霜,这是为什么呢?生姜之所以不宜在夜间食用,是因为生姜含有姜酚,姜酚能够刺激肠道蠕动,白天可以增强脾胃作用,夜晚则成了影响睡眠伤及肠道的一大问题,故夜晚不宜食用。那么早上吃姜生吃参汤,对人体到底有哪些好处呢?早晨吃姜的三大奇效(图片来源:东方IC)早在春秋末期,先师孔子就已认识到食用生姜能抗衰老。他晚年时常说“每食必姜”、“不撒姜食,不多食。”意指一年四季食不离姜,但每次不宜多吃。在饱尝战祸、颠沛流离,人平均寿命很低的时代,孔子能活到73岁,与重视食用生姜不无关系。笔者从去年春节开始,坚持天天早晨含姜,从不间断,外出旅游也带上生姜。至今含姜快 阅读全文
posted @ 2013-04-30 23:42 robotke1 阅读(242) 评论(0) 推荐(0)
摘要: (转载)http://blog.csdn.net/cuidiwhere/article/details/8452997问题1: mysql索引类型normal,unique,full text的区别是什么?normal:表示普通索引unique:表示唯一的,不允许重复的索引,如果该字段信息保证不会重复例如身份证号用作索引时,可设置为uniquefull textl: 表示 全文搜索的索引。 FULLTEXT 用于搜索很长一篇文章的时候,效果最好。用在比较短的文本,如果就一两行字的,普通的 INDEX 也可以。总结,索引的类别由建立索引的字段内容特性来决定,通常normal最常见。详细信息参考: 阅读全文
posted @ 2013-04-29 17:51 robotke1 阅读(251) 评论(0) 推荐(0)
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 54 下一页