加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

一个简单的多线程 pthread_detach

(2005-11-22 13:30:40)
分类: unix c编程
#include<pthread.h>
#include<stdio.h>
#include<unistd.h>
void print_message_function( void *ptr );
main ( )
{
        pthread_t thread1;
              while(1)
        {
                        pthread_create(&thread1,NULL,(void *)&print_message_function,(void *)0);
        printf("%d\n",thread1);
                }
        exit (0) ;
 }
void  print_message_function( void *ptr )
      pthread_detach(pthread_self());
        static int g;
        printf("%d\n", g++);
        pthread_exit(0) ;
 }
 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有