我觉得不会。另外,我在编程中也似乎从来没考虑过重入的问题。
证明如下:
1
// testtimer.cpp : 定义控制台应用程序的入口点。
2
//
3
4
#include "stdafx.h"
5
#include <windows.h>
6
#include <conio.h>
7
8
static UINT idTimer = 0;
9
static int reentry = 0;
10
static int call_cnt = 0;
11
12
void LengthyWork(void)
13

{
14
//Sleep(3000);
15
int i = 0,j = 0;
16
for(i;i < 50000;)
{
17
i++;
18
for(j = i;j > 0;)
{
19
j--;
20
}
21
}
22
23
}
24
VOID CALLBACK OnTimer(HWND hwnd,
25
UINT uMsg,
26
UINT_PTR idEvent,
27
DWORD dwTime
28
)
29

{
30
++call_cnt;
31
printf("entry(%d) reentry:%d\n",call_cnt,reentry);
32
++reentry;
33
LengthyWork();
34
--reentry;
35
printf("exit(%d) reentry:%d\n",call_cnt,reentry);
36
}
37
int _tmain(int argc, _TCHAR* argv[])
38

{
39
idTimer = SetTimer(NULL,0,1000,OnTimer);
40
int ret = 0;
41
MSG msg;
42
while(1)
{
43
if(kbhit())
{
44
return 0;
45
}
46
ret = GetMessage(&msg,NULL,0,0);
47
if(ret)
{
48
TranslateMessage(&msg);
49
DispatchMessage(&msg);
50
}
51
}
52
return 0;
53
}
54
一次执行结果如下:
entry(1) reentry:0
exit(1) reentry:0
entry(2) reentry:0
exit(2) reentry:0
entry(3) reentry:0
exit(3) reentry:0
entry(4) reentry:0
exit(4) reentry:0