昨日硬盘崩溃,全盘数据丢失,无法恢复,低格后少了2G的空间,因此未雨绸缪,公司的保留程序挑两个备份先。
//注释部分用了boost的线程库
typedef
void
(
*
Func)(
int
,
int
);
Func CBackfunc;
void
output(
int
fint,
int
frint);
//
void Cfunc();
unsigned __stdcall Cfunc(
void
*
);
void
Test();
void
main()
{
Test();
}
/**/
/*
+++++++++++++++++++++++++++++
*/
//
void Cfunc()
unsigned __stdcall Cfunc(
void
*
)
{
int
i
=
1
;
int
j
=
1
;
while
(
1
)
{
Sleep(
500
);
i
++
;
j
++
;
//
cout << i << j << endl;
CBackfunc(i , j);
}
//
return 0;
}
//
---------------------------
void
output(
int
fint,
int
frint)
{
cout
<<
"
recevie from callback function:
"
<<
fint
<<
"
@
"
<<
frint
<<
endl;
}
//
------------------------------
void
Test()
{
HANDLE hThread;
CBackfunc
=
output;
hThread
=
(HANDLE)_beginthreadex(
0
,
0
,
&
Cfunc,
0
,
0
,
0
);
WaitForSingleObject( hThread, INFINITE);
//
boost::thread mythread(&Cfunc);
//
mythread.join();
}