# microsoft/vs-threading

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/microsoft-vs-threading).**

1,036 stars · 158 forks · C# · NOASSERTION

## Links

- GitHub: https://github.com/microsoft/vs-threading
- Homepage: https://microsoft.github.io/vs-threading/
- awesome-repositories: https://awesome-repositories.com/repository/microsoft-vs-threading.md

## Topics

`analyzer` `async` `dotnet` `netstandard` `nuget` `synchronization-primitives` `threading` `ui-thread`

## Description

Vs-threading is a cross-platform .NET concurrency library and utility set for C# designed to manage multithreaded workflows, coordinate concurrent tasks, and prevent deadlocks. It supplies specialized non-blocking semaphores, events, and locks alongside asynchronous counterparts for lazy initialization, event handlers, and local storage. 

The library provides awaitable extension methods on tasks to shift execution threads, apply timeouts, and propagate cancellation tokens. It includes mechanisms to stall the main user interface thread synchronously while waiting for background tasks to finish without creating circular wait conditions.

To maintain code quality, the package integrates static analysis tools that inspect source code syntax trees during compilation. These analyzers flag legacy practices, blocking waits, foreign task await operations, and incorrect thread switching to catch common asynchronous programming mistakes early.

## Tags

### Part of an Awesome List

- [Concurrency & Threading](https://awesome-repositories.com/f/awesome-lists/devops/concurrency-threading.md) — Uses asynchronous synchronization primitives to safely coordinate concurrent tasks across multiple threads. ([source](https://microsoft.github.io/vs-threading/docs/features.html))
- [Concurrency and Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/concurrency-and-utilities.md) — Includes extension methods on tasks to shift execution threads, apply timeouts, and propagate cancellation tokens.

### Programming Languages & Runtimes

- [Concurrency Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/concurrency-libraries.md) — Provides a comprehensive cross-platform .NET concurrency library for managing multithreaded workflows and synchronization.
- [Async Coordination Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/async-coordination-libraries.md) — Manages concurrent operations and synchronizes execution flow across threads to prevent deadlocks.
- [Async Synchronization Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/async-synchronization-libraries.md) — Implements advanced asynchronous synchronization primitives and analyzers to prevent deadlocks in managed applications.
- [Concurrent Thread Execution](https://awesome-repositories.com/f/programming-languages-runtimes/concurrent-thread-execution.md) — Coordinates concurrent tasks and manages execution flow across threads to prevent race conditions. ([source](https://github.com/microsoft/vs-threading/blob/main/README.md))
- [Execution Context Switching](https://awesome-repositories.com/f/programming-languages-runtimes/concurrent-thread-execution/execution-context-switching.md) — Provides awaitable extension methods on tasks to seamlessly shift execution threads and enforce timeouts.
- [Synchronization Primitives](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution/thread-synchronized-execution/synchronization-primitives.md) — Supplies specialized non-blocking semaphores, events, and locks to coordinate concurrent execution flow across threads.
- [Lazy Asynchronous Task Management](https://awesome-repositories.com/f/programming-languages-runtimes/lazy-asynchronous-task-management.md) — Provides asynchronous lazy initialization containers to manage deferred background data cleanly.

### Development Tools & Productivity

- [POSIX Thread Synchronization Primitives](https://awesome-repositories.com/f/development-tools-productivity/thread-managers/posix-thread-api-operations/posix-thread-synchronization-primitives.md) — Manages cross-thread access using specialized primitives to prevent deadlocks and maintain thread safety. ([source](https://github.com/microsoft/vs-threading#readme))
- [Thread Activity Analysis](https://awesome-repositories.com/f/development-tools-productivity/application-resource-mapping/thread-activity-analysis.md) — Inspects source code during compilation to catch common threading mistakes and programming pitfalls.

### Networking & Communication

- [Cross-Thread Synchronizers](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/messaging-reliability/synchronous-message-receivers/cross-thread-synchronizers.md) — Manages asynchronous operations and cross-thread access using specialized primitives to maintain safety.

### Software Engineering & Architecture

- [Asynchronous Synchronization Primitives](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-synchronization-primitives.md) — Supplies specialized non-blocking semaphores, events, and locks to coordinate concurrent execution flow safely.
- [Asynchronous Concurrency Managers](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-execution-managers/asynchronous-concurrency-managers.md) — Coordinates concurrent tasks and manages execution flow across multiple threads to prevent race conditions.
- [Rust Anti-Pattern Detection](https://awesome-repositories.com/f/software-engineering-architecture/anti-patterns/rust-anti-pattern-detection.md) — Flags legacy threading practices, blocking waits, and incorrect thread switching at compile time. ([source](https://microsoft.github.io/vs-threading/analyzers/index.html))
- [Asynchronous Event Queueing](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-event-queueing.md) — Supplies asynchronous counterparts for event handlers and local storage to manage background data cleanly. ([source](https://microsoft.github.io/vs-threading/docs/features.html))
- [UI Thread Schedulers](https://awesome-repositories.com/f/software-engineering-architecture/background-thread-dispatchers/thread-safe-dispatchers/ui-thread-schedulers.md) — Stalls the user interface thread safely while waiting for background tasks to complete without creating deadlocks.
- [Thread-Safe Development](https://awesome-repositories.com/f/software-engineering-architecture/c-thread-management-utilities/thread-safe-development.md) — Applies synchronization primitives to help developers handle asynchronous workflows safely across threads. ([source](https://microsoft.github.io/vs-threading/))

### Testing & Quality Assurance

- [Static Code Analysis](https://awesome-repositories.com/f/testing-quality-assurance/static-code-analysis.md) — Inspects source code syntax trees during compilation to flag threading errors and anti-patterns early.
- [Static Code Analyzers](https://awesome-repositories.com/f/testing-quality-assurance/static-code-analyzers.md) — Integrates compilation-time static analysis tools to inspect syntax trees and catch common asynchronous programming errors early.

### Operating Systems & Systems Programming

- [Threading Analyzers](https://awesome-repositories.com/f/operating-systems-systems-programming/thread-inspection/threading-analyzers.md) — Flags legacy practices, blocking waits, and incorrect thread switching during compilation using integrated static analyzers.

### System Administration & Monitoring

- [Thread Error Trackers](https://awesome-repositories.com/f/system-administration-monitoring/diagnostic-tools/application-diagnostics/thread-error-trackers.md) — Inspects source code during compilation to catch common asynchronous programming pitfalls and threading mistakes. ([source](https://github.com/microsoft/vs-threading/blob/main/README.md))

### User Interface & Experience

- [Main Thread Dispatchers](https://awesome-repositories.com/f/user-interface-experience/main-thread-dispatchers.md) — Stalls the user interface thread synchronously while waiting for background tasks to finish without deadlocking.
