Skip to content

Commit

Permalink
Merge pull request #8 from ShawnLaMountain/main
Browse files Browse the repository at this point in the history
Updating ThunderDesign.Net-PCL.Threading to version 1.0.10
  • Loading branch information
ShawnLaMountain authored Oct 30, 2023
2 parents d9b4494 + 29d71a5 commit 894dcea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
32 changes: 12 additions & 20 deletions src/ThunderDesign.Net-PCL.SQLite/Bridges/BaseBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public BaseBridge(ISQLiteTable<TValue> bridgeTable) : base()
#endregion

#region methods
public override void Add(TValue value)
public new void Add(TValue value)
{
_ReaderWriterLockSlim.EnterWriteLock();
_ReaderWriterLockSlim.EnterUpgradeableReadLock();
try
{
if (!IsKeyAutoIncrement)
Expand All @@ -46,13 +46,13 @@ public override void Add(TValue value)
}
finally
{
_ReaderWriterLockSlim.ExitWriteLock();
_ReaderWriterLockSlim.EnterUpgradeableReadLock();
}
}

public override void Clear()
public new void Clear()
{
_ReaderWriterLockSlim.EnterWriteLock();
_ReaderWriterLockSlim.EnterUpgradeableReadLock();
try
{
Task task = BridgeTable.ResetTableAsync();
Expand All @@ -65,11 +65,11 @@ public override void Clear()
}
finally
{
_ReaderWriterLockSlim.ExitWriteLock();
_ReaderWriterLockSlim.ExitUpgradeableReadLock();
}
}

public override bool Remove(TKey key)
public new bool Remove(TKey key)
{
bool result = false;

Expand All @@ -78,19 +78,11 @@ public override bool Remove(TKey key)
{
if (this.ContainsKey(key))
{
_ReaderWriterLockSlim.EnterWriteLock();
try
{
TValue value = this[key];
Task<int> task = BridgeTable.DeleteRecordAsync(value);
value.PropertyChanged -= OnChildPropertyChanged;
result = base.Remove(key);
task.ConfigureAwait(false).GetAwaiter().GetResult();
}
finally
{
_ReaderWriterLockSlim.ExitWriteLock();
}
TValue value = this[key];
Task<int> task = BridgeTable.DeleteRecordAsync(value);
value.PropertyChanged -= OnChildPropertyChanged;
result = base.Remove(key);
task.ConfigureAwait(false).GetAwaiter().GetResult();
}
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="ThunderDesign.Net-PCL.Threading" Version="1.0.6" />
<PackageReference Include="ThunderDesign.Net-PCL.Threading" Version="1.0.10" />
<PackageReference Include="ThunderDesign.Net-PCL.ToolBox" Version="1.0.4" />
</ItemGroup>

Expand Down

0 comments on commit 894dcea

Please sign in to comment.