Files
tgstation-server/_posix_signal_handler_8cs_source.html

224 lines
37 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tgstation-server: src/Tgstation.Server.Host/System/PosixSignalHandler.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">tgstation-server<span id="projectnumber">&#160;6.19.3</span>
</div>
<div id="projectbrief">The /tg/station 13 server suite</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_codefold(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_34761767c1c3cd212f9d2f80ea0828a8.html">Tgstation.Server.Host</a></li><li class="navelem"><a class="el" href="dir_3d220027e29e19c608b6d51ce3029c32.html">System</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">PosixSignalHandler.cs</div></div>
</div><!--header-->
<div class="contents">
<a href="_posix_signal_handler_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.Threading;</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Threading.Tasks;</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> </div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>Microsoft.Extensions.Hosting;</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="keyword">using </span>Microsoft.Extensions.Logging;</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="keyword">using </span>Mono.Unix;</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="keyword">using </span>Mono.Unix.Native;</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_core.html">Tgstation.Server.Host.Core</a>;</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_utils.html">Tgstation.Server.Host.Utils</a>;</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_system.html">Tgstation.Server.Host.System</a></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span>{</div>
<div class="foldopen" id="foldopen00018" data-start="{" data-end="};">
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html"> 18</a></span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html">PosixSignalHandler</a> : <a class="code hl_class" href="class_i_hosted_service.html">IHostedService</a>, <a class="code hl_class" href="class_i_disposable.html">IDisposable</a></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> {</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a6f874242f0198ba5457e2be36f0dbc6a"> 23</a></span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a6f874242f0198ba5457e2be36f0dbc6a">CheckDelayMs</a> = 250;</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c"> 28</a></span> readonly <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control.html">IServerControl</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c">serverControl</a>;</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557"> 33</a></span> readonly <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer.html">IAsyncDelayer</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557">asyncDelayer</a>;</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724"> 38</a></span> readonly ILogger&lt;PosixSignalHandler&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>;</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd"> 43</a></span> readonly CancellationTokenSource <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd">cancellationTokenSource</a>;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f"> 48</a></span> Task? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f">signalCheckerTask</a>;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="foldopen" id="foldopen00056" data-start="{" data-end="}">
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a702097aa184590849a577eb7227508a7"> 56</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a702097aa184590849a577eb7227508a7">PosixSignalHandler</a>(<a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control.html">IServerControl</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c">serverControl</a>, <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer.html">IAsyncDelayer</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557">asyncDelayer</a>, ILogger&lt;PosixSignalHandler&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>)</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> {</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> this.serverControl = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c">serverControl</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c">serverControl</a>));</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> this.asyncDelayer = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557">asyncDelayer</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557">asyncDelayer</a>));</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> this.logger = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>));</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd">cancellationTokenSource</a> = <span class="keyword">new</span> CancellationTokenSource();</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> }</div>
</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#abc580c85a312fa4ecbc73d25326c614d"> 66</a></span> <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#abc580c85a312fa4ecbc73d25326c614d">Dispose</a>() =&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd">cancellationTokenSource</a>.Dispose();</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="foldopen" id="foldopen00069" data-start="{" data-end="}">
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a1251a072a3b3c3bce15ee2611a2e1e21"> 69</a></span> <span class="keyword">public</span> Task <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a1251a072a3b3c3bce15ee2611a2e1e21">StartAsync</a>(CancellationToken cancellationToken)</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> {</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f">signalCheckerTask</a> != <span class="keyword">null</span>)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> InvalidOperationException(<span class="stringliteral">&quot;Attempted to start PosixSignalHandler twice!&quot;</span>);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f">signalCheckerTask</a> = Task.WhenAll(</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#aa775b37e8e7b6a06494a34845894d5e8">SignalChecker</a>(Signum.SIGUSR1, <span class="keyword">false</span>),</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#aa775b37e8e7b6a06494a34845894d5e8">SignalChecker</a>(Signum.SIGUSR2, <span class="keyword">true</span>));</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordflow">return</span> Task.CompletedTask;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> }</div>
</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="foldopen" id="foldopen00082" data-start="{" data-end="}">
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#acb7428435d274ec86ffd524a4565d5cb"> 82</a></span> <span class="keyword">public</span> async Task <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#acb7428435d274ec86ffd524a4565d5cb">StopAsync</a>(CancellationToken cancellationToken)</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> {</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f">signalCheckerTask</a>?.IsCompleted != <span class="keyword">false</span>)</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogDebug(<span class="stringliteral">&quot;Stopping SignalCheckerThread...&quot;</span>);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd">cancellationTokenSource</a>.Cancel();</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogTrace(<span class="stringliteral">&quot;Joining SignalCheckerThread...&quot;</span>);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f">signalCheckerTask</a>;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> }</div>
</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> </div>
<div class="foldopen" id="foldopen00100" data-start="{" data-end="}">
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#aa775b37e8e7b6a06494a34845894d5e8"> 100</a></span> async Task <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#aa775b37e8e7b6a06494a34845894d5e8">SignalChecker</a>(Signum signum, <span class="keywordtype">bool</span> detach)</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> {</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="keywordflow">try</span></div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> {</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogTrace(<span class="stringliteral">&quot;Started SignalChecker&quot;</span>);</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> </div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keyword">using </span>var unixSignal = <span class="keyword">new</span> UnixSignal(signum);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordflow">if</span> (!unixSignal.IsSet)</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> {</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogTrace(<span class="stringliteral">&quot;Waiting for {signum}...&quot;</span>, signum);</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> var cancellationToken = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd">cancellationTokenSource</a>.Token;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="keywordflow">while</span> (!unixSignal.IsSet)</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557">asyncDelayer</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer.html#a588b00b42267c8d23088bde28d3f7fce">Delay</a>(TimeSpan.FromMilliseconds(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a6f874242f0198ba5457e2be36f0dbc6a">CheckDelayMs</a>), cancellationToken);</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogTrace(<span class="stringliteral">&quot;{signum} received!&quot;</span>, signum);</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> }</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogDebug(<span class="stringliteral">&quot;{signum} has already been sent&quot;</span>, signum);</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> </div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogTrace(<span class="stringliteral">&quot;Triggering graceful shutdown...&quot;</span>);</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c">serverControl</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control.html#a11cee342f76c81a871edc028403fbea8">GracefulShutdown</a>(detach);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> }</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">catch</span> (OperationCanceledException ex)</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> {</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogDebug(ex, <span class="stringliteral">&quot;SignalChecker cancelled!&quot;</span>);</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> }</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">catch</span> (<a class="code hl_class" href="class_exception.html">Exception</a> ex)</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> {</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogError(ex, <span class="stringliteral">&quot;SignalChecker crashed!&quot;</span>);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> }</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="keywordflow">finally</span></div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> {</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">logger</a>.LogTrace(<span class="stringliteral">&quot;Exiting SignalChecker...&quot;</span>);</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> }</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> }</div>
</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> }</div>
</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span>}</div>
<div class="ttc" id="aclass_exception_html"><div class="ttname"><a href="class_exception.html">Exception</a></div></div>
<div class="ttc" id="aclass_i_disposable_html"><div class="ttname"><a href="class_i_disposable.html">IDisposable</a></div></div>
<div class="ttc" id="aclass_i_hosted_service_html"><div class="ttname"><a href="class_i_hosted_service.html">IHostedService</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html">Tgstation.Server.Host.System.PosixSignalHandler</a></div><div class="ttdoc">Handles POSIX signals.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00018">PosixSignalHandler.cs:19</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_a1251a072a3b3c3bce15ee2611a2e1e21"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a1251a072a3b3c3bce15ee2611a2e1e21">Tgstation.Server.Host.System.PosixSignalHandler.StartAsync</a></div><div class="ttdeci">Task StartAsync(CancellationToken cancellationToken)</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00069">PosixSignalHandler.cs:69</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_a18ed05e7ba3ab8a819fe0528993ed62f"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a18ed05e7ba3ab8a819fe0528993ed62f">Tgstation.Server.Host.System.PosixSignalHandler.signalCheckerTask</a></div><div class="ttdeci">Task? signalCheckerTask</div><div class="ttdoc">The thread used to check the signal. See http://docs.go-mono.com/?link=T%3aMono.Unix....</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00048">PosixSignalHandler.cs:48</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_a377bd62aa6926c1dba634817e82f7bcd"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a377bd62aa6926c1dba634817e82f7bcd">Tgstation.Server.Host.System.PosixSignalHandler.cancellationTokenSource</a></div><div class="ttdeci">readonly CancellationTokenSource cancellationTokenSource</div><div class="ttdoc">The CancellationTokenSource used to stop the signalCheckerTask.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00043">PosixSignalHandler.cs:43</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_a6f874242f0198ba5457e2be36f0dbc6a"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a6f874242f0198ba5457e2be36f0dbc6a">Tgstation.Server.Host.System.PosixSignalHandler.CheckDelayMs</a></div><div class="ttdeci">const int CheckDelayMs</div><div class="ttdoc">Check for signals each time this amount of milliseconds pass.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00023">PosixSignalHandler.cs:23</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_a702097aa184590849a577eb7227508a7"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#a702097aa184590849a577eb7227508a7">Tgstation.Server.Host.System.PosixSignalHandler.PosixSignalHandler</a></div><div class="ttdeci">PosixSignalHandler(IServerControl serverControl, IAsyncDelayer asyncDelayer, ILogger&lt; PosixSignalHandler &gt; logger)</div><div class="ttdoc">Initializes a new instance of the PosixSignalHandler class.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00056">PosixSignalHandler.cs:56</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_aa775b37e8e7b6a06494a34845894d5e8"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#aa775b37e8e7b6a06494a34845894d5e8">Tgstation.Server.Host.System.PosixSignalHandler.SignalChecker</a></div><div class="ttdeci">async Task SignalChecker(Signum signum, bool detach)</div><div class="ttdoc">Thread for listening to signal.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00100">PosixSignalHandler.cs:100</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_ab8381d31a8a239122cacee17fb2e5724"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ab8381d31a8a239122cacee17fb2e5724">Tgstation.Server.Host.System.PosixSignalHandler.logger</a></div><div class="ttdeci">readonly ILogger&lt; PosixSignalHandler &gt; logger</div><div class="ttdoc">The ILogger for the PosixSignalHandler.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00038">PosixSignalHandler.cs:38</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_abc580c85a312fa4ecbc73d25326c614d"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#abc580c85a312fa4ecbc73d25326c614d">Tgstation.Server.Host.System.PosixSignalHandler.Dispose</a></div><div class="ttdeci">void Dispose()</div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_acb7428435d274ec86ffd524a4565d5cb"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#acb7428435d274ec86ffd524a4565d5cb">Tgstation.Server.Host.System.PosixSignalHandler.StopAsync</a></div><div class="ttdeci">async Task StopAsync(CancellationToken cancellationToken)</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00082">PosixSignalHandler.cs:82</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_ae0eb52d0de7c9b4f956580325bdd134c"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#ae0eb52d0de7c9b4f956580325bdd134c">Tgstation.Server.Host.System.PosixSignalHandler.serverControl</a></div><div class="ttdeci">readonly IServerControl serverControl</div><div class="ttdoc">The IServerControl for the PosixSignalHandler.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00028">PosixSignalHandler.cs:28</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler_html_af2c13bfeb5c8519754124739ee286557"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_signal_handler.html#af2c13bfeb5c8519754124739ee286557">Tgstation.Server.Host.System.PosixSignalHandler.asyncDelayer</a></div><div class="ttdeci">readonly IAsyncDelayer asyncDelayer</div><div class="ttdoc">The IAsyncDelayer for the PosixSignalHandler.</div><div class="ttdef"><b>Definition</b> <a href="_posix_signal_handler_8cs_source.html#l00033">PosixSignalHandler.cs:33</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control.html">Tgstation.Server.Host.Core.IServerControl</a></div><div class="ttdoc">Represents a service that may take an updated Host assembly and run it, stopping the current assembly...</div><div class="ttdef"><b>Definition</b> <a href="_i_server_control_8cs_source.html#l00009">IServerControl.cs:10</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control_html_a11cee342f76c81a871edc028403fbea8"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_core_1_1_i_server_control.html#a11cee342f76c81a871edc028403fbea8">Tgstation.Server.Host.Core.IServerControl.GracefulShutdown</a></div><div class="ttdeci">ValueTask GracefulShutdown(bool detach)</div><div class="ttdoc">Gracefully shutsdown the Host.</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer.html">Tgstation.Server.Host.Utils.IAsyncDelayer</a></div><div class="ttdoc">For waiting asynchronously.</div><div class="ttdef"><b>Definition</b> <a href="_i_async_delayer_8cs_source.html#l00010">IAsyncDelayer.cs:11</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer_html_a588b00b42267c8d23088bde28d3f7fce"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_i_async_delayer.html#a588b00b42267c8d23088bde28d3f7fce">Tgstation.Server.Host.Utils.IAsyncDelayer.Delay</a></div><div class="ttdeci">ValueTask Delay(TimeSpan timeSpan, CancellationToken cancellationToken)</div><div class="ttdoc">Create a Task that completes after a given timeSpan .</div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_core_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_core.html">Tgstation.Server.Host.Core</a></div><div class="ttdef"><b>Definition</b> <a href="_command_pipe_manager_8cs_source.html#l00016">CommandPipeManager.cs:17</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_system_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_system.html">Tgstation.Server.Host.System</a></div><div class="ttdef"><b>Definition</b> <a href="_assembly_information_provider_8cs_source.html#l00008">AssemblyInformationProvider.cs:9</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_utils_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_utils.html">Tgstation.Server.Host.Utils</a></div><div class="ttdef"><b>Definition</b> <a href="_graph_q_l_git_lab_client_8cs_source.html#l00006">GraphQLGitLabClient.cs:7</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>