@@ -36,7 +36,7 @@ final case class LongAdder private (unsafe: LongAdder.Unsafe):
3636 * @return
3737 * Unit
3838 */
39- inline def add (v : Long )(using inline frame : Frame ): Unit < Sync = Sync .Unsafe (unsafe.add(v))
39+ inline def add (v : Long )(using inline frame : Frame ): Unit < Sync = Sync .Unsafe .defer (unsafe.add(v))
4040
4141 /** Decrements the sum by one.
4242 *
@@ -45,7 +45,7 @@ final case class LongAdder private (unsafe: LongAdder.Unsafe):
4545 * @return
4646 * Unit
4747 */
48- inline def decrement (using inline frame : Frame ): Unit < Sync = Sync .Unsafe (unsafe.decrement())
48+ inline def decrement (using inline frame : Frame ): Unit < Sync = Sync .Unsafe .defer (unsafe.decrement())
4949
5050 /** Increments the sum by one.
5151 *
@@ -54,7 +54,7 @@ final case class LongAdder private (unsafe: LongAdder.Unsafe):
5454 * @return
5555 * Unit
5656 */
57- inline def increment (using inline frame : Frame ): Unit < Sync = Sync .Unsafe (unsafe.increment())
57+ inline def increment (using inline frame : Frame ): Unit < Sync = Sync .Unsafe .defer (unsafe.increment())
5858
5959 /** Returns the current sum.
6060 *
@@ -64,7 +64,7 @@ final case class LongAdder private (unsafe: LongAdder.Unsafe):
6464 * @return
6565 * The current sum
6666 */
67- inline def get (using inline frame : Frame ): Long < Sync = Sync .Unsafe (unsafe.get())
67+ inline def get (using inline frame : Frame ): Long < Sync = Sync .Unsafe .defer (unsafe.get())
6868
6969 /** Resets the sum to zero.
7070 *
@@ -73,7 +73,7 @@ final case class LongAdder private (unsafe: LongAdder.Unsafe):
7373 * @return
7474 * Unit
7575 */
76- inline def reset (using inline frame : Frame ): Unit < Sync = Sync .Unsafe (unsafe.reset())
76+ inline def reset (using inline frame : Frame ): Unit < Sync = Sync .Unsafe .defer (unsafe.reset())
7777
7878 /** Returns the current sum and resets it to zero.
7979 *
@@ -83,7 +83,7 @@ final case class LongAdder private (unsafe: LongAdder.Unsafe):
8383 * @return
8484 * The sum before reset,
8585 */
86- inline def sumThenReset (using inline frame : Frame ): Long < Sync = Sync .Unsafe (unsafe.sumThenReset())
86+ inline def sumThenReset (using inline frame : Frame ): Long < Sync = Sync .Unsafe .defer (unsafe.sumThenReset())
8787
8888end LongAdder
8989
@@ -103,7 +103,7 @@ object LongAdder:
103103 * The result of applying the function
104104 */
105105 inline def initWith [A , S ](inline f : LongAdder => A < S )(using inline frame : Frame ): A < (Sync & S ) =
106- Sync .Unsafe (f(LongAdder (Unsafe .init())))
106+ Sync .Unsafe .defer (f(LongAdder (Unsafe .init())))
107107
108108 /** WARNING: Low-level API meant for integrations, libraries, and performance-sensitive code. See AllowUnsafe for more details. */
109109 opaque type Unsafe = j.LongAdder
@@ -158,7 +158,7 @@ final case class DoubleAdder private (unsafe: DoubleAdder.Unsafe):
158158 * @return
159159 * Unit
160160 */
161- inline def add (v : Double )(using inline frame : Frame ): Unit < Sync = Sync .Unsafe (unsafe.add(v))
161+ inline def add (v : Double )(using inline frame : Frame ): Unit < Sync = Sync .Unsafe .defer (unsafe.add(v))
162162
163163 /** Returns the current sum.
164164 *
@@ -168,7 +168,7 @@ final case class DoubleAdder private (unsafe: DoubleAdder.Unsafe):
168168 * @return
169169 * The current sum
170170 */
171- inline def get (using inline frame : Frame ): Double < Sync = Sync .Unsafe (unsafe.get())
171+ inline def get (using inline frame : Frame ): Double < Sync = Sync .Unsafe .defer (unsafe.get())
172172
173173 /** Resets the sum to zero.
174174 *
@@ -177,7 +177,7 @@ final case class DoubleAdder private (unsafe: DoubleAdder.Unsafe):
177177 * @return
178178 * Unit
179179 */
180- inline def reset (using inline frame : Frame ): Unit < Sync = Sync .Unsafe (unsafe.reset())
180+ inline def reset (using inline frame : Frame ): Unit < Sync = Sync .Unsafe .defer (unsafe.reset())
181181
182182 /** Returns the current sum and resets it to zero.
183183 *
@@ -187,7 +187,7 @@ final case class DoubleAdder private (unsafe: DoubleAdder.Unsafe):
187187 * @return
188188 * The sum before reset,
189189 */
190- inline def sumThenReset (using inline frame : Frame ): Double < Sync = Sync .Unsafe (unsafe.sumThenReset())
190+ inline def sumThenReset (using inline frame : Frame ): Double < Sync = Sync .Unsafe .defer (unsafe.sumThenReset())
191191
192192end DoubleAdder
193193
@@ -207,7 +207,7 @@ object DoubleAdder:
207207 * The result of applying the function
208208 */
209209 inline def initWith [A , S ](inline f : DoubleAdder => A < S )(using inline frame : Frame ): A < (Sync & S ) =
210- Sync .Unsafe (f(DoubleAdder (Unsafe .init())))
210+ Sync .Unsafe .defer (f(DoubleAdder (Unsafe .init())))
211211
212212 /** WARNING: Low-level API meant for integrations, libraries, and performance-sensitive code. See AllowUnsafe for more details. */
213213 opaque type Unsafe = j.DoubleAdder
0 commit comments