Skip to content

Commit

Permalink
updated benchmark version
Browse files Browse the repository at this point in the history
small refacto on WorkerBarrier
  • Loading branch information
Doraku committed Nov 2, 2018
1 parent a89081f commit 5285d18
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![DefaultEcs](https://github.com/Doraku/DefaultEcs/blob/master/DefaultEcsLogo.png)
DefaultEcs is an Entity Component System framework which aims to be accessible with little constraints while retaining as much performance as possible for game development.

[![NuGet](https://img.shields.io/badge/nuget-v0.6.2-brightgreen.svg)](https://www.nuget.org/packages/DefaultEcs)
[![NuGet](https://img.shields.io/badge/nuget-v0.6.3-brightgreen.svg)](https://www.nuget.org/packages/DefaultEcs)

- [Requirement](#Requirement)
- [Overview](#Overview)
Expand Down
4 changes: 2 additions & 2 deletions source/DefaultEcs.Benchmark/DefaultEcs.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.1" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.11.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.11.2" />

<!--<PackageReference Include="MonoGame.Extended.Entities" Version="1.1.0" />
Expand Down
3 changes: 2 additions & 1 deletion source/DefaultEcs/DefaultEcs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
<RepositoryType>git</RepositoryType>
<PackageTags>gamedev game-development game-engine ecs entity-component-system</PackageTags>

<Version>0.6.2</Version>
<Version>0.6.3</Version>
<PackageReleaseNotes>
reduced cpu usage of multithreading SystemRunner when idling
</PackageReleaseNotes>
</PropertyGroup>
</Project>
6 changes: 4 additions & 2 deletions source/DefaultEcs/Technical/System/WorkerBarrier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public WorkerBarrier(int workerCount)
_count = workerCount;
_endHandle = new ManualResetEvent(false);
_startHandle = new ManualResetEvent(false);

_allStarted = false;
_runningCount = 0;
}

#endregion
Expand All @@ -33,7 +36,6 @@ public WorkerBarrier(int workerCount)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void StartWorkers()
{
Interlocked.Exchange(ref _runningCount, _count * 2);
Volatile.Write(ref _allStarted, false);
_startHandle.Set();
}
Expand All @@ -43,7 +45,7 @@ public void Start()
{
_startHandle.WaitOne();

if (Interlocked.Decrement(ref _runningCount) == _count)
if (Interlocked.Increment(ref _runningCount) == _count)
{
_startHandle.Reset();
Volatile.Write(ref _allStarted, true);
Expand Down

0 comments on commit 5285d18

Please sign in to comment.