#2204·reactive

Add support for System.Threading.Lock

Author: JakenVeinaCreated May 21, 2025Updated May 21, 2026
Labels[area] Rx

Feature request

Please describe the feature.

Is there any interest in new operators for directly supporting System.Threading.Lock objects, where locks are used? E.G.

cs
public static IObservable<T> Synchronize<T>(
    this    IObservable<T>  source,
            Lock            gate);

in addition to

cs
public static IObservable<T> Synchronize<T>(
    this    IObservable<T>  source,
            object          gate);

Given that anyone wanting this operator, or similar ones, would have to implement it from scratch, rather than through composition of existing operators, that System.Threading.Lock is now considered a threading primitive, and that it would not produce any compatibility issues, it seems like a good candidate for support in the core library,

Which next library version (i.e., patch, minor or major)?

As a non-breaking new feature, this could be introduced in the next minor version.

What are the platform(s), environment(s) and related component version(s)?

System.Threading.Lock is available .NET 9+.

As I understand, System.Reactive does not currently produce target-specific artifacts above .NET 6? If so, build targeting config would need to be adjusted to add .NET 9+ artifacts.

How commonly is this feature needed (one project, several projects, company-wide, global)?

Currently, DynamicData is using a custom version of the Synchronize operator, internally, for .NET 9+ targets.

I'll be happy to provide a PR for this feature, if deemed appropriate.