Kenny's profileWalk on!PhotosBlogListsMore ![]() | Help |
|
5/4/2007 切记线程之间的通信不能通过函数内部变量unsigned __stdcall func1( void* b )
{ int *p = (int*)b; printf("%d", *p ); return 1; } void func2()
{ int n = 100; int *p = &n; _beginthreadex( NULL, 0, &func1, &n, 0, NULL ); } int main()
{
func2();
return 0;
}
func2中p与func1中b的值一样,输出结果不为100。原因?自己google一下~ |
|
|