Skip to content

Commit 113d3fb

Browse files
committed
deprecate NIOEventLoopGroupProvider (#2142)
1 parent 6ba8f4f commit 113d3fb

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Sources/NIOCore/Docs.docc/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ More specialized modules provide concrete implementations of many of the abstrac
2121

2222
- ``EventLoopGroup``
2323
- ``EventLoop``
24-
- ``NIOEventLoopGroupProvider``
2524
- ``EventLoopIterator``
2625
- ``Scheduled``
2726
- ``RepeatedTask``

Sources/NIOCore/EventLoop.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,16 +1246,33 @@ extension EventLoopGroup {
12461246
}
12471247
#endif
12481248

1249-
/// This type is intended to be used by libraries which use NIO, and offer their users either the option
1249+
/// Deprecated.
1250+
///
1251+
/// This type was intended to be used by libraries which use NIO, and offer their users either the option
12501252
/// to `.share` an existing event loop group or create (and manage) a new one (`.createNew`) and let it be
12511253
/// managed by given library and its lifecycle.
1254+
///
1255+
/// Please use a `group: any EventLoopGroup` parameter instead. If you want to default to a global
1256+
/// singleton group instead, consider group: any EventLoopGroup = MultiThreadedEventLoopGroup.singleton` or
1257+
/// similar.
1258+
///
1259+
/// - See also: https://github.com/apple/swift-nio/issues/2142
12521260
public enum NIOEventLoopGroupProvider {
12531261
/// Use an `EventLoopGroup` provided by the user.
12541262
/// The owner of this group is responsible for its lifecycle.
12551263
case shared(EventLoopGroup)
1256-
/// Create a new `EventLoopGroup` when necessary.
1264+
1265+
/// Deprecated. Create a new `EventLoopGroup` when necessary.
12571266
/// The library which accepts this provider takes ownership of the created event loop group,
12581267
/// and must ensure its proper shutdown when the library is being shut down.
1268+
@available(
1269+
*,
1270+
deprecated,
1271+
message: """
1272+
Please use `.shared(existingGroup)` or use the singleton via
1273+
`.shared(MultiThreadedEventLoopGroup.singleton)` or similar
1274+
"""
1275+
)
12591276
case createNew
12601277
}
12611278

0 commit comments

Comments
 (0)