Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Everything / programming / threads

Threads

threads

Great Reads

by Evgeny Pereguda
Clone of PCSX/PCSX2/PPSSPP emulator for Windows 10 on WPF/C# with "touch" control
by Hari Mahadevan
Describes a C++ class that encapsulates the WaitForMultipleObjects API usage pattern making it easy to integrate it with C++ objects.
by Hari Mahadevan
Describes a C++ class that encapsulates the WaitForMultipleObjects API usage pattern making it easy to integrate it with C++ objects.
by Sebastian Solnica
A case of a deadlock in a .NET application

Latest Articles

by Evgeny Pereguda
Clone of PCSX/PCSX2/PPSSPP emulator for Windows 10 on WPF/C# with "touch" control
by Hari Mahadevan
Describes a C++ class that encapsulates the WaitForMultipleObjects API usage pattern making it easy to integrate it with C++ objects.
by Hari Mahadevan
Describes a C++ class that encapsulates the WaitForMultipleObjects API usage pattern making it easy to integrate it with C++ objects.
by Sebastian Solnica
A case of a deadlock in a .NET application

All Articles

Sort by Score

threads 

by Senthilvel Samatharman
This tip provides a simple implementation for the ICommand interface and enables to write quick code leaving the nuances of fetching the return types and asynchrony
by Alessandro Lentini
How to write a simple multi-thread queue for the typical producer-consumer process
by honey the codewitch
Creating an application that can run once, but then accept command line args from subsequent runs
by Sen Jacob
A simple task scheduler utility by which you can schedule a task to run at any time or interval
by Sen Jacob
This is an alternative for "A Task Scheduler Library for .NET Applications"
by Steven Coco
This illustrates a simple pattern that provides a lock that can always be invoked; and may be a no-op for a non-synchronized implementation.
by Martin Vorbrodt
Advanced thread pool
by Steffen Ploetz
How to implement modal windows with OpenTK on Linux, that behave like dialog boxes on Windows
by Steffen Ploetz
How to provide modal UI application components without leaving the UI thread or pause/block it
by Anand Gunasekaran
Scanner automatically scans multiple pages using BackgroundWorker Thread
by Chandra Shekhar Joshi
How to implement the Queue of Background Worker
by Martin Vorbrodt
Blocking queue
by Thrivikram Hathwar
How to broadcast data using .NET TPL dataflow
by mohamedkamaleed
Network check v1.0
by Sarang Date
Introduction My Colleagues Guru and Amit brought an interesting discussion on the use of timers in a multithreaded environment. I have tried below to clarify a few things about different timer classes and their usage scenarios with pros and cons. This info is based on the various blogs I...
by manish31383
How to do controlled ThreadPooling using .NET Framework 4.0.
by Surendra Adhikari SA
Implimenting a message box that closes automatically using thread.
by AfnanMof
Steps How to Develop Sharepoint Windows Forms
by Ahmed Elkafrawy
An easy way to simulate keyboard press & release keys to another application
by Eduardo Antonio Cecilio Fernandes
Add asynchronous tasks, using threads, in Android activities while updating its progress to the UI. Use this technique for SDKs lower than 1.5.
by Martin Vorbrodt
Fast semaphore
by Timmy Kokke
When writing a demo for the Dutch Code-camp  I ran into issues getting back on the UI thread after calling a webservice. The call to the webservice was made from the UI thread, but the callback was made on a different thread. The System.Threading.SynchronizationContext class held the...
by suis
Integrating Google direction and geocoding services using C#. NET code behind.
by SabirDeveloper
Handler for WaitAll() and WaitAny() limitation problem.
by idonotexistatall
How to make an HTTP Server and some documentation on server-side protocol
by Karthik Kalyanasundaram
Do you really need an explicit call to _endthreadex() in your thread function created using _beginthreadex()
by Martin Vorbrodt
L1 cache lines
by Vlad Neculai Vizitiu
LinqPAD Script of the Day: WorldClock
by FDW
Lock multiple (up to 2) objects, non blocking
by Paulo Zemek
This code is buggy.See the line:if (Monitor.TryEnter(po1) && Monitor.TryEnter(po2)) return;Imagine that the lock to po1 is true, but for po2 is false (or vice-versa).It will not return, and later will lock po1 again.So, when unlocking, it will unlock the wrong number of...
by Marc Leger
ORM, databinding, asynchronous data access, and transactions
by User 468701
Task.Factory.StartNew can be very useful for executing a method on another thread where you don't care about the result, but it can also make the host method hard to test. This tip describes how to inject Task.Factory and mock it for testing.
by metastruct
Multithreaded, customizable SysLog server in C#.
by Tony Dubey
Huge improvement on Multithreading in new Task Parallel Library for .NET 4
by PavyBez
OrderedLock in C# to catch potential deadlocks at runtime
by Anwaar Ahmed
Performing the same task with and without using threads
by Lance Roberts
A tray utility for monitoring log files and popping up error messages
by Hrishi Gupte
Processing Collection in C# .NET using multiple threads
by Wonde Tadesse
How to utilize QueueBackgroundWorkItem(QBWI) for web applications that run a background process in IIS environment.
by essence
Make your synchronizion easier by using Read/Write extensions.
by evry1falls
Receiving response correctly from pop mail server is the first step on receiving emails to your own email client.
by Simon P Stevens
This code provides SafeTrigger extension methods as a way of triggering events in a thread safe way.For details on usage, a discussion of reasons and alternatives, and a full solution download see my article on safely triggering events[^]Multiple overloads are provided for convenience to...
by Sergey Alexandrovich Kryukov
A generic class to be used as a conveyor for data and tasks between threads
by dwilliss
In .NET 4.0, you can use:New Concurrent.BlockingCollection(New Queue)This even has an option on the constructor to let you specify a maximum queue depth. If it reaches this depth, a call to Add will block until the consumer thread takes something out of the queue.
by Jean A Brandelero
Learn how to do cross-thread operarions, the easy way!
by Bartlomiej Filipek
Simple introduction to std::future and std::async and why they can be useful.
by Martin Vorbrodt
Simple thread pool
by Sharp Ninja
Threading can be a daunting topic. This library takes much of the worry (and mistakes) out of multi-threaded application programming.
by Evgeniy Sukhikh
The most elegant implementation for VB.NET and safe as simple
by codemunkeh
Lock has pitfalls: let's use Monitor.TryEnter with less boilerplate
by Bryan Lyman
Generic list wrapper that returns a smaller strongly typed sub-list which modifies the parent-list when changed, without using events
by essence
ConcurrentDictionary's methods can call your value factory more than once.When is this a problem? How can it be overcome?
by Asif Bahrainwala
Atomic set and test in critical sections
by venugopalm
Calling thread cannot access this object because a different thread owns it
by Bruno van Dooren
What to do when you want to use the current thread handle
by Ger Hayden
Working introduction to Parallel Programming
by me.ajaykumar
Thread safe collections
by Arun Babu Madhavan
Extension method to throttle multiple Tasks in C#
by Kunal Chowdhury «IN»
Working with event handler
by Andrew Rissing
A simple trick to remove the delay of Thread.Sleep for unit testing.
by Thomas Roll
Thread.Sleep cannot be cancelled. To inject a pause, consider using the Cancellation Token instead.
by honey the codewitch
This tip shows you how to do UI updates without having to worry about locking.
by grantliu
Utilize NLog.net in a Service-oriented architecture
by Eddy Vluggen
You've been taught to give every component and variable a descriptive name; why do most then don't do it for a thread, when it is easy and beneficial?