Tagged articles - Thread

Found 3 articles tagged with Thread

How to avoid Thread.Sleep in your production code in .NET
Avoiding Thread.Sleep in production code in .NET using C#
0
I am pretty sure any of us used Thread.Sleep method to pause the current thread execution. Mostly this is used to simulate long running process during the test or debug. While this is fine to use for testing, if your intention is to actually schedule thread execution this is probably wrong way of doing it, simply because Thread.Sleep does not actually take as many milliseconds as you pass to the method as a parameter... read more
ConcurrentDictionary vs Hashtable.Synchronized
Comparison of collections in multithread environment
 
0
Basically all Dictionary collections in .NET internally implement Hashtable wrapped, so in terms of mechanism they are pretty much the same. The difference is that Dictionary exposes strong types while Hashtable uses object-object keyvalue pair which is much harder to work with because you need to know what is the actual type of the object stored in a key or value. Often casting will probably be required. In multithread code environment locking is considered by default when accessing any shared resource... read more
Avoiding high processor load in long running loops
Keep processor not overloaded with long running loops
0
When having a long running loop which you are not sure when it is going to end you will probably have to create a loop in a separate loop and on every iterration you will check whether some condition is true and exit the loop. Let's say you want to execute some piece of code after some specific time, let's say after one minute or everyday at specific time (common scenario in windows services). You can do it really simple with Timer class and just few lines of code as the code below. ... read more

.NET

read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more