mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
Provide a mechanism to repeatedly schedule a task in the EventLoop Motivation: In some cases a certain task should run repeatedly, like polling an API or querying a database. For these scenarios a repeated scheduling mechanism is beneficial. Modifications: Added a method to EventLoop to schedule repeated tasks. Result: It is possible to schedule task with an initial delay and a fixed delay now. Furthermore, these task can be cancelled.
49 lines
2.1 KiB
Swift
49 lines
2.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// EventLoopTest+XCTest.swift
|
|
//
|
|
import XCTest
|
|
|
|
///
|
|
/// NOTE: This file was generated by generate_linux_tests.rb
|
|
///
|
|
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
|
///
|
|
|
|
extension EventLoopTest {
|
|
|
|
static var allTests : [(String, (EventLoopTest) -> () throws -> Void)] {
|
|
return [
|
|
("testSchedule", testSchedule),
|
|
("testScheduleWithDelay", testScheduleWithDelay),
|
|
("testScheduleCancelled", testScheduleCancelled),
|
|
("testScheduleRepeatedTask", testScheduleRepeatedTask),
|
|
("testScheduleRepeatedTaskCancelFromDifferentThread", testScheduleRepeatedTaskCancelFromDifferentThread),
|
|
("testScheduleRepeatedTaskToNotRetainRepeatedTask", testScheduleRepeatedTaskToNotRetainRepeatedTask),
|
|
("testScheduleRepeatedTaskToNotRetainEventLoop", testScheduleRepeatedTaskToNotRetainEventLoop),
|
|
("testMultipleShutdown", testMultipleShutdown),
|
|
("testShuttingDownFailsRegistration", testShuttingDownFailsRegistration),
|
|
("testEventLoopThreads", testEventLoopThreads),
|
|
("testEventLoopPinned", testEventLoopPinned),
|
|
("testEventLoopPinnedCPUIdsConstructor", testEventLoopPinnedCPUIdsConstructor),
|
|
("testCurrentEventLoop", testCurrentEventLoop),
|
|
("testShutdownWhileScheduledTasksNotReady", testShutdownWhileScheduledTasksNotReady),
|
|
("testCloseFutureNotifiedBeforeUnblock", testCloseFutureNotifiedBeforeUnblock),
|
|
("testScheduleMultipleTasks", testScheduleMultipleTasks),
|
|
]
|
|
}
|
|
}
|
|
|