# < Summary

Information

Class: | Renci.SshNet.Abstractions.ThreadAbstraction
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Abstractions\ThreadAbstraction.cs

Line coverage
61%

Covered lines: | 11
Uncovered lines: | 7
Coverable lines: | 18
Total lines: | 53
Line coverage: | 61.1%

Branch coverage
50%

Covered branches: | 2
Total branches: | 4
Branch coverage: | 50%

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
Sleep(...) | 100% | 1 | 0%
ExecuteThreadLongRunning(...) | 50% | 2 | 77.77%
ExecuteThread(...) | 50% | 2 | 66.66%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Abstractions\ThreadAbstraction.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Threading;`
|  | `3` |  | `using System.Threading.Tasks;`
|  | `4` |  | ``
|  | `5` |  | `namespace Renci.SshNet.Abstractions`
|  | `6` |  | `{`
|  | `7` |  | `internal static class ThreadAbstraction`
|  | `8` |  | `{`
|  | `9` |  | `/// <summary>`
|  | `10` |  | `/// Suspends the current thread for the specified number of milliseconds.`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `/// <param name="millisecondsTimeout">The number of milliseconds for which the thread is suspended.</param>`
|  | `13` |  | `public static void Sleep(int millisecondsTimeout)`
| 0 | `14` |  | `{`
| 0 | `15` |  | `Thread.Sleep(millisecondsTimeout);`
| 0 | `16` |  | `}`
|  | `17` |  | ``
|  | `18` |  | `/// <summary>`
|  | `19` |  | `/// Creates and starts a long-running <see cref="Task"/> for the specified <see cref="Action"/>.`
|  | `20` |  | `/// </summary>`
|  | `21` |  | `/// <param name="action">The <see cref="Action"/> to start.</param>`
|  | `22` |  | `/// <exception cref="ArgumentNullException"><paramref name="action"/> is <see langword="null"/>.</exception>`
|  | `23` |  | `/// <returns>`
|  | `24` |  | `/// A task that represents the execution of the specified <see cref="Action"/>.`
|  | `25` |  | `/// </returns>`
|  | `26` |  | `public static Task ExecuteThreadLongRunning(Action action)`
| 1817 | `27` |  | `{`
| 1817 | `28` |  | `if (action is null)`
| 0 | `29` |  | `{`
| 0 | `30` |  | `throw new ArgumentNullException(nameof(action));`
|  | `31` |  | `}`
|  | `32` |  | ``
| 1817 | `33` |  | `return Task.Factory.StartNew(action,`
| 1817 | `34` |  | `CancellationToken.None,`
| 1817 | `35` |  | `TaskCreationOptions.LongRunning,`
| 1817 | `36` |  | `TaskScheduler.Current);`
| 1817 | `37` |  | `}`
|  | `38` |  | ``
|  | `39` |  | `/// <summary>`
|  | `40` |  | `/// Executes the specified action in a separate thread.`
|  | `41` |  | `/// </summary>`
|  | `42` |  | `/// <param name="action">The action to execute.</param>`
|  | `43` |  | `public static void ExecuteThread(Action action)`
| 3672 | `44` |  | `{`
| 3672 | `45` |  | `if (action is null)`
| 0 | `46` |  | `{`
| 0 | `47` |  | `throw new ArgumentNullException(nameof(action));`
|  | `48` |  | `}`
|  | `49` |  | ``
| 7344 | `50` |  | `_ = ThreadPool.QueueUserWorkItem(o => action());`
| 3672 | `51` |  | `}`
|  | `52` |  | `}`
|  | `53` |  | `}`

# Methods/Properties

Sleep(System.Int32)
ExecuteThreadLongRunning(System.Action)
ExecuteThread(System.Action)