Comparator

I recently wrote a generic PriorityQueue class which can treat any type of object as the priority (not just integers).  Specifically, the class looked like this:public class PriorityQueue<T, TPriority> { public PriorityQueue() : this(false) { … } public PriorityQueue(bool invert) : this(Comparer<TPriority>.Default) { … } public PriorityQueue(IComparer<TPriority> comparer) { … } public void Enqueue(T item,…

0

SynchronizationCallback

It’s common for user interface frameworks (such as Windows Forms applications or Visual Studio packages) to restrict API calls to a single thread; specifically the “UI” thread that is usually the original or “main” thread in the process.  This means that if you spawn a background thread then it can’t touch the user interface’s objects…

5

ThreadQueue

I was writing an application the other day that required serializing objects to a set of files on a network share as a user is entering data.  The writing is done “live” (instead of waiting until the user closes the application) because there are other applications on other computers that sync to the changes by…

0