Einzelnen Beitrag anzeigen

Der schöne Günther
Online

Registriert seit: 6. Mär 2013
6.092 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: LeaveCriticalSection: Warum das nachfolgenden sleep(0)?

  Alt 24. Apr 2015, 13:34
Delphi 2, Windows NT. Ernsthaft?

Sleep macht nichts anderes als die WinApi-Routine "Sleep" aufzurufen.

In der Doku dazu steht:´
Zitat:
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.

Windows XP: A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. This behavior changed starting with Windows Server 2003.
Also bis WinXP tut es entweder das, was TThread.Yield() macht, oder auch gar nichts. Je nachdem wie es lustig ist.
  Mit Zitat antworten Zitat