@@ -17,18 +17,20 @@ import OrderedCollections
1717/// only one low priority usage allowed at one time.
1818public actor AsyncCountdownEvent : AsyncObject {
1919 /// The suspended tasks continuation type.
20- private typealias Continuation = GlobalContinuation < Void , Error >
20+ @usableFromInline
21+ typealias Continuation = GlobalContinuation < Void , Error >
2122 /// The continuations stored with an associated key for all the suspended task that are waiting to be resumed.
22- private var continuations : OrderedDictionary < UUID , Continuation > = [ : ]
23- /// The lower limit for the countdown event to trigger.
23+ @usableFromInline
24+ private( set) var continuations : OrderedDictionary < UUID , Continuation > = [ : ]
25+ /// The limit up to which the countdown counts and triggers event.
2426 ///
2527 /// By default this is set to zero and can be changed during initialization.
2628 public let limit : UInt
2729 /// Current count of the countdown.
2830 ///
2931 /// If the current count becomes less or equal to limit, queued tasks
3032 /// are resumed from suspension until current count exceeds limit.
31- public private ( set ) var currentCount : UInt
33+ public var currentCount : UInt
3234 /// Initial count of the countdown when count started.
3335 ///
3436 /// Can be changed after initialization
@@ -44,8 +46,8 @@ public actor AsyncCountdownEvent: AsyncObject {
4446 /// - Parameters:
4547 /// - continuation: The `continuation` to add.
4648 /// - key: The key in the map.
47- @inline ( __always )
48- private func addContinuation(
49+ @inlinable
50+ func addContinuation(
4951 _ continuation: Continuation ,
5052 withKey key: UUID
5153 ) {
@@ -56,24 +58,24 @@ public actor AsyncCountdownEvent: AsyncObject {
5658 /// from `continuations` map and resumes with `CancellationError`.
5759 ///
5860 /// - Parameter key: The key in the map.
59- @inline ( __always )
60- private func removeContinuation( withKey key: UUID ) {
61+ @inlinable
62+ func removeContinuation( withKey key: UUID ) {
6163 let continuation = continuations. removeValue ( forKey: key)
6264 continuation? . cancel ( )
6365 }
6466
6567 /// Decrements countdown count by the provided number.
6668 ///
6769 /// - Parameter number: The number to decrement count by.
68- @inline ( __always )
69- private func decrementCount( by number: UInt = 1 ) {
70+ @inlinable
71+ func decrementCount( by number: UInt = 1 ) {
7072 guard currentCount > 0 else { return }
7173 currentCount -= number
7274 }
7375
7476 /// Resume previously waiting continuations for countdown event.
75- @inline ( __always )
76- private func resumeContinuations( ) {
77+ @inlinable
78+ func resumeContinuations( ) {
7779 while !continuations. isEmpty && isSet {
7880 let ( _, continuation) = continuations. removeFirst ( )
7981 continuation. resume ( )
@@ -89,8 +91,8 @@ public actor AsyncCountdownEvent: AsyncObject {
8991 /// Continuation can be resumed with error and some cleanup code can be run here.
9092 ///
9193 /// - Throws: If `resume(throwing:)` is called on the continuation, this function throws that error.
92- @inline ( __always )
93- private func withPromisedContinuation( ) async throws {
94+ @inlinable
95+ func withPromisedContinuation( ) async throws {
9496 let key = UUID ( )
9597 try await withTaskCancellationHandler { [ weak self] in
9698 Task { [ weak self] in
0 commit comments