/// <summary> /// Creates new instance of <see cref="AtomicLong"/> /// </summary> /// <param name="value">The value to store</param> /// <param name="order">Affects the way store operation occur. Load operations are always use <see cref="MemoryOrder.Acquire"/> semantics</param> /// <param name="align">True to store the underlying value aligned, otherwise False</param> public AtomicLong(long value, MemoryOrder order = MemoryOrder.SeqCst, bool align = false) { if (!order.IsSpported()) { throw new ArgumentException(string.Format("{0} is not supported", order)); } _order = order; this._storage = BoxedInt64.Create(value, align); }
/// <summary> /// Creates new instance of <see cref="AtomicLong"/> /// </summary> /// <param name="value">The value to store</param> /// <param name="order">Affects the way store operation occur. Load operations are always use <see cref="MemoryOrder.Acquire"/> semantics</param> /// <param name="align">True to store the underlying value aligned, otherwise False</param> public AtomicLong(long value, MemoryOrder order = MemoryOrder.SeqCst, bool align = false) { order.ThrowIfNotSupported(); _order = order; if (align) { this._storage = BoxedInt64.Create(value); } else { this.acqRelValue = value; this._storage = BoxedInt64.Create(this); } }