跳至內容

Ada 程式設計/庫/System.Atomic Operations.Exchange

來自維基文庫,面向開放世界的開放書籍

此語言特性已在 Ada 2022 中推出。

自 Ada 2022 以來,System.Atomic Operations.Exchange 一直是 預定義語言環境 的一個單元。p

generic
   type Atomic_Type is private with Atomic;
package System.Atomic_Operations.Exchange
   with Pure, Nonblocking is

   function Atomic_Exchange (Item  : aliased in out Atomic_Type;
                             Value : Atomic_Type) return Atomic_Type
      with Convention => Intrinsic;

   function Atomic_Compare_And_Exchange 
     (Item    : aliased in out Atomic_Type;
      Prior   : aliased in out Atomic_Type;
      Desired : Atomic_Type) return Boolean
      with Convention => Intrinsic;

   function Is_Lock_Free (Item : aliased Atomic_Type) return Boolean
      with Convention => Intrinsic;

end System.Atomic_Operations.Exchange;
華夏公益教科書