06 2012 档案

摘要:或许习惯于用高级语言编程的大部分同学都会忽略了函数调用的具体过程是怎样的,如果想知道这个过程就不得不从汇编入手,但汇编语言又晦涩难懂。在这里谨以一个简单的例子说说我对函数调用过程的学习心得。 先上C语言写的代码: 1 #include<stdio.h> 2 3 4 unsigned int test(int a,int b) 5 { 6 int c,d; 7 c = a; 8 d = b; 9 return c;10 }11 12 int main()13 {14 unsigned int r;15 16 r = test(1,2);17 ... 阅读全文
posted @ 2012-06-03 20:27 lknlfy 阅读(2705) 评论(0) 推荐(0)
摘要:作为多任务实现的一种机制,多线程应用得非常广泛,相对于多进程,多线程不仅运行效率高,而且还可以提高系统资源的使用效率。虽然网上关于多线程的讲解已经有一大堆,但出于学习的心态,有必要在这里做一下笔记。一、多线程编程常用函数1. int pthread_create(pthread_t * thread,const pthread_attr_t * attr,void * (*start_routine)(void *), void *arg);作用:创建一个新线程参数:thread:线程IDattr:线程属性(包括调度策略,调度参数,堆栈地址,堆栈大小等)。一般设置为NULL,即采用系统默... 阅读全文
posted @ 2012-06-02 19:29 lknlfy 阅读(980) 评论(0) 推荐(0)