//===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project // // Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of SwiftNIO project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// import XCTest @testable import NIO import Dispatch import NIOConcurrencyHelpers class NIOThreadPoolTest: XCTestCase { func testThreadNamesAreSetUp() { let numberOfThreads = 11 let pool = NIOThreadPool(numberOfThreads: numberOfThreads) pool.start() defer { XCTAssertNoThrow(try pool.syncShutdownGracefully()) } var allThreadNames: Set = [] let lock = Lock() let threadNameCollectionSem = DispatchSemaphore(value: 0) let threadBlockingSem = DispatchSemaphore(value: 0) // let's use up all the threads for i in (0..