allthetimeintheworld
Programmer
Hi all,
I have built a pretty simple application (with no forms or visual components). The Main entry point calls the following function that checks the current time and loops until it passes a certain time:
This is compiled into an EXE file (I'm using VFP7.0)
The problem that I am seeing is that, while this EXE is running, Word and Excel applications are running very slow: specifically document open and clipboard paste operations seem to be affected. They seem to be pausing for about 5 seconds: the same time set in the Sleep() function.
If I reduce the sleep time to 500 millis, the apparent pause in word and excel also reduces.
If I kill my application, Word and Excel performance returns to 'normal'.
My understanding of this is that the sleep should only block the current thread: how it can block threads in a separate process space is beyond me. Somehow, am I taking some system wide mutex by calling sleep?
Can anyone tell me what is going on here and how I can fix it?
Thanks
I have built a pretty simple application (with no forms or visual components). The Main entry point calls the following function that checks the current time and loops until it passes a certain time:
Code:
FUNCTION sleepUntil(wakeUpTime)
PRIVATE hasBeenPrevious, secs
DECLARE Sleep IN Win32API INTEGER
m.secs = SECONDS()
m.hasBeenPrevious = (m.secs < m.wakeuptime)
* Do this loop until wakeup time overtakes real time
* but do it at least until
DO WHILE m.secs < m.wakeUpTime OR !m.hasBeenPrevious
? m.secs
m.secs = SECONDS()
m.hasBeenPrevious = ((m.secs < m.wakeuptime) OR m.hasBeenPrevious)
Sleep(5000)
ENDDO
ENDFUNC
This is compiled into an EXE file (I'm using VFP7.0)
The problem that I am seeing is that, while this EXE is running, Word and Excel applications are running very slow: specifically document open and clipboard paste operations seem to be affected. They seem to be pausing for about 5 seconds: the same time set in the Sleep() function.
If I reduce the sleep time to 500 millis, the apparent pause in word and excel also reduces.
If I kill my application, Word and Excel performance returns to 'normal'.
My understanding of this is that the sleep should only block the current thread: how it can block threads in a separate process space is beyond me. Somehow, am I taking some system wide mutex by calling sleep?
Can anyone tell me what is going on here and how I can fix it?
Thanks