Last active
October 6, 2015 21:05
-
-
Save i3arnon/9f4e2f5044c89662911a to your computer and use it in GitHub Desktop.
High contention when creating new timers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
for (var i = 0; i < Environment.ProcessorCount; i++) | |
{ | |
Task.Factory.StartNew(() => | |
{ | |
while (true) | |
{ | |
new Timer(_ => { }, null, TimeSpan.FromMilliseconds(100), Timeout.InfiniteTimeSpan); | |
} | |
}, TaskCreationOptions.LongRunning); | |
} | |
Console.ReadLine(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment