dotnet / dotnet/reactive

Add support for System.Threading.Lock

Open
#2,204 1 comment 0 reactions 0 assignees View on GitHub
[area] Rx
Dominant language
C#
Stars
7.2k
Forks
798
PR merge metrics
No merged PRs in 30d

Description

#### 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 Synchronize(
this IObservable source,
Lock gate);
```

in addition to

```cs
public static IObservable Synchronize(
this IObservable 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](https://github.com/reactivemarbles/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.