首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

C语言创造线程-简单例程

2012-08-10 
C语言创建线程-简单例程#includewindows.h #includeprocess.h/*_beginthread,_endthread*/ #includes

C语言创建线程-简单例程
#include   <windows.h> 
#include   <process.h>         /*   _beginthread,   _endthread   */ 
#include   <stddef.h> 
#include   <stdlib.h> 
#include   <conio.h> 




void   Bounce(   void   *ch   ); 


int    main() 

        char  ch='A'; 

//第一个参数为函数地址,第二个为栈大小,第三个为函数的参数列表指针

_beginthread(Bounce, 0, (void*)(ch++)); 
Sleep( 8000  ); 
return 0;





void   Bounce(   void   *ch   ) 

while(1)
printf("theadTest\n"); 
        _endthread(); 

热点排行