Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorBuchelnikov committed Mar 31, 2021
2 parents 57a10d1 + 213b604 commit 13c3ff1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/ObservableComputations.Test/OcDispatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ public void TestSetThreadProperites()
OcConfiguration.SaveInstantiationStackTrace = true;
OcDispatcher dispatcher = new OcDispatcher(2);
Assert.AreEqual(dispatcher.GetQueueCount(0), 0);
Assert.AreEqual(dispatcher.GetQueueCount(), 0);
Assert.IsTrue(dispatcher.InstantiationStackTrace != null);
ApartmentState apartmentState = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? ApartmentState.Unknown : ApartmentState.MTA;
Assert.AreEqual(dispatcher.NewInvocationBehaviour, NewInvocationBehaviour.Accept);
Expand Down
16 changes: 7 additions & 9 deletions src/ObservableComputations/ObservableComputations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<Authors>Igor Buchelnikov ([email protected])</Authors>
<Company>Igor Buchelnikov ([email protected])</Company>
<Description>Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces. The computations include ones similar to LINQ, the computation of arbitrary expression and additional features. The computations are implemented as extension methods, like LINQ ones. You can combine calls of ObservableComputations extension methods including chaining and nesting, as you do for LINQ methods. Computations in background threads, including parallel ones, as well as time-related processing of CollectionChanged and PropertyChanged events, are supported. ObservableComputations is easy to use and powerful implementation of reactive programming paradigm. With ObservableComputations, your code will fit more to the functional style than with standard LINQ.</Description>
<Description>Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces. The computations include ones similar to LINQ, the computation of arbitrary expression, and additional features. The computations are implemented as extension methods, like LINQ ones. You can combine calls of ObservableComputations extension methods including chaining and nesting, as you do for LINQ methods. Computations in background threads, including parallel ones, as well as time-related processing of CollectionChanged and PropertyChanged events, are supported. ObservableComputations is easy to use and powerful implementation of reactive programming paradigm. With ObservableComputations, your code will fit more to the functional style than with standard LINQ.</Description>
<PackageLicenseUrl>https://github.com/IgorBuchelnikov/ObservableComputations/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/IgorBuchelnikov/ObservableComputations</PackageProjectUrl>
<RepositoryUrl>https://github.com/IgorBuchelnikov/ObservableComputations.git</RepositoryUrl>
Expand All @@ -19,28 +19,26 @@
<NeutralLanguage>en</NeutralLanguage>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>* New feaures
OcDispatcher async delegates with await
OcDispatcher InvocationResult IReadScalar
OcDispatcher InvocationResult Invocation
OcDispatcher Status Property

<PackageReleaseNotes>* New features
"async" and "await" keywords support in OcDispatcher
OcDispatcher's InvocationResult now implements IReadScalar

* Fixed:
— CollectionPausing
— ScalarPausing
— CollectionDispatching
— OcDispatcher
— other bug fixes

* Renamed
InvocationResult.Result -&gt; InvocationResult.Value
DebugInfo.ExecutingOcDispatcherInvocations -&gt; StaticInfo.ExecutingOcDispatcherInvocationStacks
DebugInfo -&gt; StaticInfo
OcDispatcher.BeginInvoke -&gt; OcDispatcher.InvokeAsync
Configuration -&gt; OcConfiguration

* API changed
— Binding
</PackageReleaseNotes>
— StaticInfo</PackageReleaseNotes>
<Version>2.1.0</Version>
<AssemblyName>ObservableComputations</AssemblyName>
<PackageId>ObservableComputations</PackageId>
Expand Down
6 changes: 5 additions & 1 deletion src/ObservableComputations/OcDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ThreadState = System.Threading.ThreadState;
Expand Down Expand Up @@ -188,7 +189,10 @@ public NewInvocationBehaviour NewInvocationBehaviour
}
}

public int GetQueueCount(int priority = 0) => _invocationQueues[priority].Count;
public int GetQueueCount(int? priority = null) =>
priority == null
? _invocationQueues.Sum(q => q.Count)
: _invocationQueues[priority.Value].Count;

internal Invocation queueInvocation(Action action, int priority, object context,
bool setSynchronizationContext, Invocation parent, ManualResetEventSlim doneManualResetEvent = null)
Expand Down

0 comments on commit 13c3ff1

Please sign in to comment.