fix: Adds more debugging to the timer system. Simplifies the timer pool. (#1195)
This commit is contained in:
parent
d5416b6dec
commit
919b7e9416
6 changed files with 99 additions and 38 deletions
|
|
@ -144,11 +144,7 @@ public partial class Timer
|
|||
|
||||
internal override void OnDetach()
|
||||
{
|
||||
if (Running)
|
||||
{
|
||||
logger.Error("Timer is returned while still running!\n{StackTrace}", new StackTrace());
|
||||
return;
|
||||
}
|
||||
base.OnDetach();
|
||||
|
||||
if (_returnOnDetach)
|
||||
{
|
||||
|
|
@ -177,10 +173,6 @@ public partial class Timer
|
|||
var timer = GetFromPool();
|
||||
if (timer != null)
|
||||
{
|
||||
#if DEBUG_TIMERS
|
||||
logger.Information("Getting from pool: ({Count} / {Capacity})", _poolCount, _poolCapacity);
|
||||
#endif
|
||||
|
||||
timer.Init(delay, interval, count);
|
||||
timer._continuation = callback;
|
||||
timer._returnOnDetach = false;
|
||||
|
|
@ -191,8 +183,6 @@ public partial class Timer
|
|||
return timer;
|
||||
}
|
||||
|
||||
_timerPoolDepletionAmount++;
|
||||
|
||||
#if DEBUG_TIMERS
|
||||
logger.Warning("Timer pool depleted and timer was allocated.\n{StackTrace}", new StackTrace());
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue