Mutex is not new to the .NET framework. The Win32 api supports an object called Mutex and .NET framework class Mutex is actually a wrapper class for the same Win32 kernel mutex object. Mutex objects are generally used to synchronize Threads across process. Mutexes are namable and hence you can signal whether the Mutex is acquired or not… Read More »
Generally when you create a WPF window, you will get two files automatically created for you. One which represents the XAML, which is stored in .XAML extension file, and another is a class which is stored in a Code-Behind file with .cs extension. But in certain scenarios, it is actually required to write your Code – behind directly… Read More »
While working with UI based applications, one of the most important thing that you need to keep in mind is Thread Affinity. It ensures that every control needs to be created in the UI Thread to be ported in the UI and each of them could only be accessed through UI Thread only. Earlier, the Windows Forms application… Read More »
Similar to Lazy, ThreadLocal creates object local to one thread. So each individual thread will have its own Lazy initializer object and hence will create the object multiple times once for each thread. In .NET 3.5 or before, you can create objects that are local to one thread using ThreadStatic attribute. But sometimes ThreadStatic fails to create a… Read More »
Multi-Threading is not new to the programming world. We use multi-threading in our application to enhance the throughput and responsiveness of the application, but with concurrent access of certain resources, the application is prone to deadlocks and Race conditions. The post will guide you through how to avoid such kind of scenarios.
Yesterday, I have posted one tip which discusses how you could use ReaderWriterLock to implement shared locking on items that does require concurrent access. Today I will use SpinLock to do the same. SpinLock like Monitor spins a number of CPU cycles when it tries to acquire a lock. Monitor on the other hand Spins some CPU Cycle… Read More »
Thread shutdown is a mechanism to stop a worker Thread that is already running in parallel. That means either to stop an already running thread using Thread.Abort or shutting down the Thread normally using the user defined code.
Writing a stretchable content container is very easy in WPF. The ViewBox allows you to write stretchable container which will shrink / expand according to the size of the content. In this post I will build a simple Stretchable ContentControl which will expand itself as you go on adding controls to it.