|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
TTimer vs sleep fro win32 service applicatian?
what are possible pro's and con's for each of this solution?
|
|
#2
|
||||
|
||||
|
Personally I recommend TTimer ... sleep can cause the service to hang.
__________________
If i've been helpful, please add to my reputation. My unfinished site: http://www.dever.ro |
|
#3
|
|||
|
|||
|
Quote:
I agree too.. Use TTimer. |
|
#4
|
|||
|
|||
|
Maybe, that TTIme is better, however I am a bit confused in which thread its omExecute handler run?
|
|
#5
|
||||
|
||||
|
Quote:
ServiceThread |
|
#6
|
|||
|
|||
|
procedure Delay(Milliseconds: Int64);
var Tick: DWord; Event: THandle; s: Int64; begin Event := CreateEvent(nil, False, False, nil); try Tick := GetTickCount + DWord(Milliseconds); while (Milliseconds > 0) and (MsgWaitForMultipleObjects(1, Event, False, Milliseconds, QS_ALLINPUT) <> WAIT_TIMEOUT) do begin Application.ProcessMessages; s := GetTickCount; Milliseconds := Tick - s; end; finally CloseHandle(Event); end; end; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > TTimer vs sleep fro win32 service applicatian? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|