读书人

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

发布时间: 2012-08-10 12:19:33 作者: rapoo

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();
}

读书人网 >C语言

热点推荐