Archives

帖子来自 woods2001 RSS

woods2001

多线程编程-线程的创建和终止

作者: woods2001 (2 篇文章) 日期: 九月 22, 2011 在 1:33 下午
评论 (1)

1.引言: Linux系统下的多线程遵循POSIX线程接口,称为pthread。编写Linux下的多线程程序,需要使用头文件pthread.h,连接时需要使用库libpthread.a。顺便说一下,Linux下pthread的实现是通过系统调用clone()来实现的。clone()是Linux所特有的系统调用,它的使用方式类似fork,关于clone()的详细情况,有兴趣的读者可以去查看有关文档说明。   pthread_t在头文件/usr/include/bits/pthreadtypes.h中定义:   typedef unsigned long int pthread_t; 它是一个线程的标识符。 2.函数说明: (1)函数原型: #include int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict ...

继续 ›

分类: 博客征文专栏, 并行计算

多线程编程 - 线程的创建和终止

作者: woods2001 (2 篇文章) 日期: 七月 4, 2011 在 11:03 上午
评论 (0)

  1.引言: Linux系统下的多线程遵循POSIX线程接口,称为pthread。编写Linux下的多线程程序,需要使用头文件pthread.h,连接时需要使用库libpthread.a。顺便说一下,Linux下pthread的实现是通过系统调用clone()来实现的。clone()是Linux所特有的系统调用,它的使用方式类似fork,关于clone()的详细情况,有兴趣的读者可以去查看有关文档说明。   pthread_t在头文件/usr/include/bits/pthreadtypes.h中定义:   typedef unsigned long int pthread_t; 它是一个线程的标识符。 2.函数说明: (1)函数原型: #include int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict ...

继续 ›

分类: 博客征文专栏, 并行计算