Skip to content

Commit

Permalink
Change constructor signature to use RealmConfiguration vs Realm
Browse files Browse the repository at this point in the history
Old: public RealmThread(Realms.Realm realm)
New: public RealmThread(Realms.RealmConfiguration realmConfig)
  • Loading branch information
sushihangover committed Dec 7, 2016
1 parent a38d037 commit fdd5096
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/RealmThread.Shared/RealmThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public int ManagedThreadId
/// Initializes a new instance of the <see cref="T:SushiHangover.RealmThread"/> class.
/// </summary>
/// <param name="realm">Realm.</param>
public RealmThread(Realms.Realm realm)
public RealmThread(Realms.RealmConfiguration realmConfig)
{
////D.WriteLine("RealmThread Constructor");
workQueue = new BlockingCollection<RealmWork>();
realmThread = new InternalThread(workQueue);
realmThread.Start(realm);
realmThread.Start(realmConfig);
}

/// <summary>
Expand Down Expand Up @@ -136,10 +136,10 @@ public void Join()
_thread?.Join();
}

public void Run(object parentRealm)
public void Run(object parentRealmConfig)
{
_Id = Thread.CurrentThread.ManagedThreadId;
using (var localRealm = Realms.Realm.GetInstance((parentRealm as Realms.Realm).Config))
using (var localRealm = Realms.Realm.GetInstance(parentRealmConfig as Realms.RealmConfiguration))
{

//D.WriteLine($"RealmThread Starting Thread: {_Id}");
Expand Down
12 changes: 6 additions & 6 deletions src/RealmThread.Tests.Android/RealmThread.Tests.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@
<HintPath>..\packages\System.Reactive.PlatformServices.3.1.1\lib\netstandard1.3\System.Reactive.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="FormsViewGroup">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.Android">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -164,5 +164,5 @@
<Import Project="..\packages\Realm.0.80.0\build\Realm.targets" Condition="Exists('..\packages\Realm.0.80.0\build\Realm.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Import Project="..\packages\xunit.runner.devices.2.1.0\build\MonoAndroid\xunit.runner.devices.targets" Condition="Exists('..\packages\xunit.runner.devices.2.1.0\build\MonoAndroid\xunit.runner.devices.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.3.168\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.3.168\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
</Project>
8 changes: 4 additions & 4 deletions src/RealmThread.Tests.Shared/RealmThreadRead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ await Task.Run(() =>
{
st.Start();
var realmThread = new RealmThread(cache);
var realmThread = new RealmThread(cache.Config);
realmThread.BeginInvoke(threadSafeRealm =>
{
foreach (var v in toFetch)
Expand Down Expand Up @@ -72,7 +72,7 @@ await Task.Run(() =>
{
st.Start();
using (var realmThread = new RealmThread(cache))
using (var realmThread = new RealmThread(cache.Config))
{
Parallel.ForEach(
toFetch,
Expand Down Expand Up @@ -111,7 +111,7 @@ await Task.Run(() =>
var partitoner = Partitioner.Create(toFetch, EnumerablePartitionerOptions.NoBuffering);
Parallel.ForEach(
partitoner,
() => new RealmThread(cache),
() => new RealmThread(cache.Config),
(key, loopState, realmThread) =>
{
realmThread.BeginInvoke(threadSafeRealm =>
Expand Down Expand Up @@ -174,7 +174,7 @@ public async Task GeneratePerfRangesForBlock2(Func<Realms.Realm, int, List<strin
{
List<string> keys = null;

using (var realmThread = new RealmThread(cache))
using (var realmThread = new RealmThread(cache.Config))
{
realmThread.BeginInvoke(r =>
{
Expand Down
8 changes: 4 additions & 4 deletions src/RealmThread.Tests.Shared/RealmThreadWrite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ await cache.WriteAsync((obj) =>
await Task.Run(() =>
{
using (var blockingQueue = new BlockingCollection<string>())
using (var realmThreadWrite = new RealmThread(cache))
using (var realmThreadRead = new RealmThread(cache))
using (var realmThreadWrite = new RealmThread(cache.Config))
using (var realmThreadRead = new RealmThread(cache.Config))
{
Parallel.Invoke(() =>
{
Expand Down Expand Up @@ -98,7 +98,7 @@ await GeneratePerfRangesForRealm(async (cache, size) =>
await Task.Run(() =>
{
using (var realmThread = new RealmThread(cache))
using (var realmThread = new RealmThread(cache.Config))
{
realmThread.BeginInvoke((threadSafeRealm) =>
{
Expand Down Expand Up @@ -132,7 +132,7 @@ await GeneratePerfRangesForRealm(async (cache, size) =>
var st = new Stopwatch();
st.Start();
using (var realmThread = new RealmThread(cache))
using (var realmThread = new RealmThread(cache.Config))
{
await realmThread.InvokeAsync(async (threadSafeRealm) =>
{
Expand Down
10 changes: 5 additions & 5 deletions src/RealmThread.Tests.iOS/RealmThread.Tests.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.iOS">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.3.3.168\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -181,5 +181,5 @@
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
<Import Project="..\packages\Realm.0.80.0\build\Realm.targets" Condition="Exists('..\packages\Realm.0.80.0\build\Realm.targets')" />
<Import Project="..\packages\xunit.runner.devices.2.1.0\build\Xamarin.iOS\xunit.runner.devices.targets" Condition="Exists('..\packages\xunit.runner.devices.2.1.0\build\Xamarin.iOS\xunit.runner.devices.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.3.168\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.3.168\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
</Project>

0 comments on commit fdd5096

Please sign in to comment.