System.SyncObjs.TSpinWait

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

  TSpinWait = record
  private const
    YieldThreshold = 10;
    Sleep1Threshold = 20;
    Sleep0Threshold = 5;
  private
    FCount: Integer;
    function GetNextSpinCycleWillYield: Boolean;
  public
    procedure Reset;
    procedure SpinCycle;
    class procedure SpinUntil(const ACondition: TFunc<Boolean>); overload; static;
    class function SpinUntil(const ACondition: TFunc<Boolean>; Timeout: Cardinal): Boolean; overload; static;
    class function SpinUntil(const ACondition: TFunc<Boolean>; const Timeout: TTimeSpan): Boolean; overload; static;
    property Count: Integer read FCount;
    property NextSpinCycleWillYield: Boolean read GetNextSpinCycleWillYield;
  end;

C++

struct DECLSPEC_DRECORD TSpinWait
{
private:
    static const System::Int8 YieldThreshold = System::Int8(0xa);
    static const System::Int8 Sleep1Threshold = System::Int8(0x14);
    static const System::Int8 Sleep0Threshold = System::Int8(0x5);
    int FCount;
    bool __fastcall GetNextSpinCycleWillYield();
public:
    void __fastcall Reset();
    void __fastcall SpinCycle();
    static void __fastcall SpinUntil(const System::DelphiInterface<System::Sysutils::TFunc__1<bool> > ACondition)/* overload */;
    static bool __fastcall SpinUntil(const System::DelphiInterface<System::Sysutils::TFunc__1<bool> > ACondition, unsigned Timeout)/* overload */;
    static bool __fastcall SpinUntil(const System::DelphiInterface<System::Sysutils::TFunc__1<bool> > ACondition, const System::Timespan::TTimeSpan &Timeout)/* overload */;
    __property int Count = {read=FCount};
    __property bool NextSpinCycleWillYield = {read=GetNextSpinCycleWillYield};
};

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
record
struct
public
System.SyncObjs.pas
System.SyncObjs.hpp
System.SyncObjs System.SyncObjs

Beschreibung

Eine Instanz von TSpinWait ermöglicht dem aktuellen Thread, eine Anzahl von Spin-Zyklen abzuwarten.

Mit dem TSpinWait-Record kann ein Thread veranlasst werden, eine Anzahl von Spin-Zyklen abzuwarten. Im Gegensatz zu der Methode TThread.Sleep wird bei TSpinWait für den aktuellen Thread der verbleibende Abschnitt der Prozessorzeit nicht abgegeben.

Siehe auch

Code-Beispiele