Dreamine.Threading.Windows
1.0.1
이 패키지는 다른 어셈블리에서 `DMContainer`를 partial class로 확장하지 않습니다. 등록은 별도의 Registration 클래스를 통해 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
WindowsTimerResolutionService.cs
이 파일의 문서화 페이지로 가기
1
using
Dreamine.Threading.Interfaces;
2
using
Dreamine.Threading.Windows.Native
;
3
4
namespace
Dreamine.Threading.Windows.Services
;
5
14
public
sealed
class
WindowsTimerResolutionService
: ITimerResolutionService, IDisposable
15
{
24
private
readonly
object
_syncRoot
=
new
();
33
private
readonly uint
_period
;
42
private
int
_referenceCount
;
51
private
bool
_disposed
;
52
61
public
WindowsTimerResolutionService
()
62
: this(1)
63
{
64
}
65
82
public
WindowsTimerResolutionService
(uint period)
83
{
84
_period
= period == 0 ? 1 : period;
85
}
86
119
public
void
Begin
()
120
{
121
lock (
_syncRoot
)
122
{
123
ThrowIfDisposed
();
124
125
if
(
_referenceCount
== 0)
126
{
127
WinMmNativeMethods.timeBeginPeriod(
_period
);
128
}
129
130
_referenceCount
++;
131
}
132
}
133
158
public
void
End
()
159
{
160
lock (
_syncRoot
)
161
{
162
if
(
_disposed
)
163
{
164
return
;
165
}
166
167
if
(
_referenceCount
<= 0)
168
{
169
return
;
170
}
171
172
_referenceCount
--;
173
174
if
(
_referenceCount
== 0)
175
{
176
WinMmNativeMethods.timeEndPeriod(
_period
);
177
}
178
}
179
}
180
197
public
void
Dispose
()
198
{
199
lock (
_syncRoot
)
200
{
201
if
(
_disposed
)
202
{
203
return
;
204
}
205
206
while
(
_referenceCount
> 0)
207
{
208
WinMmNativeMethods.timeEndPeriod(
_period
);
209
_referenceCount
--;
210
}
211
212
_disposed
=
true
;
213
}
214
}
215
232
private
void
ThrowIfDisposed
()
233
{
234
if
(
_disposed
)
235
{
236
throw
new
ObjectDisposedException(nameof(
WindowsTimerResolutionService
));
237
}
238
}
239
}
Dreamine.Threading.Windows.Native
Definition
Kernel32NativeMethods.cs:4
Dreamine.Threading.Windows.Services
Definition
WindowsCpuInfoProvider.cs:3
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService.ThrowIfDisposed
void ThrowIfDisposed()
Definition
WindowsTimerResolutionService.cs:232
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService.Dispose
void Dispose()
Definition
WindowsTimerResolutionService.cs:197
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService._referenceCount
int _referenceCount
Definition
WindowsTimerResolutionService.cs:42
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService._period
readonly uint _period
Definition
WindowsTimerResolutionService.cs:33
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService.WindowsTimerResolutionService
WindowsTimerResolutionService(uint period)
Definition
WindowsTimerResolutionService.cs:82
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService.Begin
void Begin()
Definition
WindowsTimerResolutionService.cs:119
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService._syncRoot
readonly object _syncRoot
Definition
WindowsTimerResolutionService.cs:24
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService.End
void End()
Definition
WindowsTimerResolutionService.cs:158
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService.WindowsTimerResolutionService
WindowsTimerResolutionService()
Definition
WindowsTimerResolutionService.cs:61
Dreamine.Threading.Windows.Services.WindowsTimerResolutionService._disposed
bool _disposed
Definition
WindowsTimerResolutionService.cs:51
Services
WindowsTimerResolutionService.cs
다음에 의해 생성됨 :
1.17.0