跳至内容

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;
华夏公益教科书