Category Archives: threading

Use BeginInvoke and callbacks to perform tasks asynchronously in C#

The example Use BeginInvoke and EndInvoke to perform tasks asynchronously in C# explains one way to call a method asynchronously so it can run on a separate core or CPU. In that example, the program calls BeginInvoke several times to … Continue reading

Posted in algorithms, graphics, image processing, threading | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Use BeginInvoke and EndInvoke to perform tasks asynchronously in C#

This example uses the Emboss method to create embossed images. How that method works isn’t important to the discussion of working asynchronously so it isn’t covered here. Download the example to see how it works. The only thing about that … Continue reading

Posted in algorithms, graphics, image processing, threading | Tagged , , , , , , , , , , , , , | Leave a comment

Let a thread call a form’s methods in C#

When the user clicks the Start Thread button, this program runs a counter on a separate thread. Every second the counter updates the form’s Value variable. It then displays the thread’s number and the new Value in the ListBox at … Continue reading

Posted in algorithms, programs, system, threading | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Run threads with different priorities in C#

This example runs several different threads at different priorities. Each of the threads executes the following Counter class’s Run method. class Counter { // This counter’s number. public string Name; // Initializing constructor. public Counter(string name) { Name = name; … Continue reading

Posted in algorithms, programs, system, threading | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Flush click events in C#

If a button starts a long task, you probably don’t want the user to be able to click the button again (or perhaps not anything in the application) until the task finishes. The following code shows a straightforward attempt to … Continue reading

Posted in API, controls, events, syntax, system, threading | Tagged , , , , , , , , , , , , , | 12 Comments

Use WMI to get the number of physical and logical processors in C#

This example shows how you can determine your computer’s number of processors, both physical and logical. Many computers these days contain multiple CPUs. Each CPU may contain multiple cores, processors that can execute instructions. Finally, some cores can execute multiple … Continue reading

Posted in performance, system, threading, WMI | Tagged , , , , , , , , , , , , , , , | Leave a comment

Use a BackgroundWorker in C#

This example shows how to use a BackgroundWorker component to easily perform a task in the background while the program continues running. The example Use multiple threads to draw a graph in C# lets you perform an action in the … Continue reading

Posted in controls, programs, threading | Tagged , , , , , , , , , , | 8 Comments

Use multiple threads to draw a graph in C#

This example shows how you can use multiple threads to let a program draw a graph and perform other tasks at the same time. A thread is a path of execution through a single process. Multi-threading allows an application to … Continue reading

Posted in graphics, programs, threading | Tagged , , , , , , , , , , , | 2 Comments

A plea for help: Tell me what you want to see in my blog!

I get remarkably little feedback from my blog. I track post views and know that I have 857 Twitter followers, but people rarely let me know if they particularly like or dislike a post. That makes it hard for me … Continue reading

Posted in ADO.NET, algorithms, animation, API, challenges, combinatorics, controls, cryptography, curve fitting, database, extension methods, files, fonts, fractals, games, geometry, globalization, graphics, internationalization, LINQ, localization, mathematics, Office, phone, printing, reflection, registry, serialization, threading, transformations, user interface, Word, wpf, XAML, XML | 13 Comments