Linux多线程编程的基本的函数
函数原型:
#include <pthread.h>
int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict attr, void *(*start_rtn)(void),void *restrict arg);
返回值:若是成功建立线程返回0,否则返回错误的编号
形式参数:
pthread_t *restrict tidp 要创建的线程的线程id指针
const pthread_attr_t *restrict attr 创建线程时的线程属性
void* (start_rtn)(void) 返回值是void类型的指针函数
vodi *restrict arg start_rtn的行参
例题1:
功能:测试建立一个新的线程
程序名称: pthread_test.c
#include <pthread.h>
#include <stdio.h>
void *create(void *arg)
...{
printf("new thread created ..... ");
}
int main(int argc,char *argv[])
...{
pthread_t tidp;
int error;
error=pthread_create(&tidp,NULL,create,NULL);
if(error!=0)
......{
printf("pthread_create is not created ... ");
return -1;
}
printf("prthread_create is created... ");
return 0;
}
编译方法:
#gcc -Wal
相关文档:
3、PHP安装
1)还是下载源码包,如:php-5.1.1.tar.gz,下载地址:http://www.php.net
2)解压缩,>tar -zxvf php-5.1.1.tar.gz
3)进入php-5.1.1,>cd php-5.1.1
4)安装配置,>./configure --prefix=/opt/php
--with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql
--with-mysqli=/opt/mysql/bin/ ......
Linux下mbstring安装
1、用cd命令进入php的源代码目录下的etc/mbstring目录下,如“/src/php5.2.5”,即“cd /src/php5.2.5”;
2、>/usr/local/php/bin/phpize (假设php安装在/usr/local/php目录下)
3、编译配置,>./configure --with-php-config=/usr/local/php/bin/php-config
4、执行 ......
Linuxmine收集整理 作者:linux宝库 (http://www.linuxmine.com) 1. 不要当“传教士”
很多人在讨论区不断的引起 "Linux vs. Windows" 之类的讨论,甚至争的面红耳赤,这是没有必要的。
这种争论是浪费时间而没有任何用处的。对,你花了一下午,用许多事实“捍卫”了 “Linux 比 Windows 好” 这个说法。但是 Win ......
原文地址:http://www.wangzhongyuan.com/archives/488.html
以下是一个Linux/Unix下由两个管道提供双向数据流的C程序,这是操作系统课程中经常使用的基本程序
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
int m ......