File tree Expand file tree Collapse file tree 10 files changed +22
-18
lines changed
NHibernate.Test/NHSpecificTest Expand file tree Collapse file tree 10 files changed +22
-18
lines changed Original file line number Diff line number Diff line change 6
6
<VersionPatch Condition =" '$(VersionPatch)' == ''" >0</VersionPatch >
7
7
<!-- Clear VersionSuffix for making release and set it to dev for making development builds -->
8
8
<VersionSuffix Condition =" '$(VersionSuffix)' == ''" >dev</VersionSuffix >
9
- <LangVersion Condition =" '$(MSBuildProjectExtension)' != '.vbproj'" >12.0 </LangVersion >
9
+ <LangVersion Condition =" '$(MSBuildProjectExtension)' != '.vbproj'" >preview </LangVersion >
10
10
11
11
<VersionPrefix Condition =" '$(VersionPrefix)' == ''" >$(NhVersion).$(VersionPatch)</VersionPrefix >
12
12
<VersionSuffix Condition =" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != ''" >$(VersionSuffix).$(BuildNumber)</VersionSuffix >
Original file line number Diff line number Diff line change 1
- using System ;
1
+ using System ;
2
2
using System . Collections ;
3
3
using System . Collections . Generic ;
4
4
using System . Text ;
@@ -15,7 +15,7 @@ public class Fixture
15
15
[ Test ]
16
16
public void GetTypeWithLenShouldBeThreadSafe ( )
17
17
{
18
- object sync = new object ( ) ;
18
+ Lock sync = new Lock ( ) ;
19
19
List < Exception > exceptions = new List < Exception > ( ) ;
20
20
21
21
ManualResetEvent startEvent = new ManualResetEvent ( false ) ;
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ protected override void OnTearDown()
45
45
[ Test ]
46
46
public void HqlIsThreadsafe_UsingThreads ( )
47
47
{
48
- object sync = new object ( ) ;
48
+ Lock sync = new Lock ( ) ;
49
49
List < int > results = new List < int > ( ) ;
50
50
List < Exception > exceptions = new List < Exception > ( ) ;
51
51
Original file line number Diff line number Diff line change @@ -10,28 +10,23 @@ class SyncCacheLock : ICacheLock
10
10
11
11
class MonitorLock : IDisposable
12
12
{
13
- private readonly object _lockObj ;
14
-
15
- public MonitorLock ( object lockObj )
16
- {
17
- _lockObj = lockObj ;
18
- }
13
+ private readonly Lock _lockObj = new Lock ( ) ;
19
14
20
15
public IDisposable Lock ( )
21
16
{
22
- Monitor . Enter ( _lockObj ) ;
17
+ _lockObj . Enter ( ) ;
23
18
return this ;
24
19
}
25
20
26
21
public void Dispose ( )
27
22
{
28
- Monitor . Exit ( _lockObj ) ;
23
+ _lockObj . Exit ( ) ;
29
24
}
30
25
}
31
26
32
27
public SyncCacheLock ( )
33
28
{
34
- _monitorLock = new MonitorLock ( this ) ;
29
+ _monitorLock = new ( ) ;
35
30
}
36
31
37
32
public void Dispose ( )
Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Threading ;
2
3
3
4
namespace NHibernate . Cache
4
5
{
@@ -11,7 +12,7 @@ namespace NHibernate.Cache
11
12
/// </remarks>
12
13
public static class Timestamper
13
14
{
14
- private static object lockObject = new object ( ) ;
15
+ private static Lock lockObject = new Lock ( ) ;
15
16
16
17
// hibernate is using System.currentMilliSeconds which is calculated
17
18
// from jan 1, 1970
Original file line number Diff line number Diff line change 1
1
using System . Collections ;
2
2
using System . Collections . Concurrent ;
3
+ using System . Threading ;
3
4
using NHibernate . Engine ;
4
5
5
6
namespace NHibernate . Context
@@ -9,7 +10,7 @@ public abstract class MapBasedSessionContext : CurrentSessionContext
9
10
private readonly ISessionFactoryImplementor _factory ;
10
11
11
12
// Must be static, different instances of MapBasedSessionContext may have to yield the same map.
12
- private static readonly object _locker = new object ( ) ;
13
+ private static readonly Lock _locker = new Lock ( ) ;
13
14
14
15
protected MapBasedSessionContext ( ISessionFactoryImplementor factory )
15
16
{
Original file line number Diff line number Diff line change 73
73
<PackageReference Include =" Microsoft.CSharp" Version =" 4.7.0" />
74
74
</ItemGroup >
75
75
76
+ <ItemGroup Condition =" !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" >
77
+ <PackageReference Include =" Backport.System.Threading.Lock" Version =" 1.1.6" />
78
+ </ItemGroup >
79
+
76
80
<ItemGroup >
77
81
<Content Include =" *.xsd" >
78
82
<PackagePath >./</PackagePath >
Original file line number Diff line number Diff line change 3
3
using System . Text ;
4
4
using NHibernate . Engine ;
5
5
using System . Linq ;
6
+ using System . Threading ;
6
7
7
8
namespace NHibernate . Stat
8
9
{
9
10
public class StatisticsImpl : IStatistics , IStatisticsImplementor
10
11
{
11
- private readonly object _syncRoot = new object ( ) ;
12
+ private readonly Lock _syncRoot = new Lock ( ) ;
12
13
13
14
private static readonly INHibernateLogger log = NHibernateLogger . For ( typeof ( StatisticsImpl ) ) ;
14
15
private readonly ISessionFactoryImplementor sessionFactory ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Runtime . Serialization ;
3
+ using System . Threading ;
3
4
4
5
namespace NHibernate . Util
5
6
{
@@ -17,7 +18,7 @@ public class SimpleMRUCache : IDeserializationCallback
17
18
{
18
19
private const int DefaultStrongRefCount = 128 ;
19
20
20
- private readonly object _syncRoot = new object ( ) ;
21
+ private readonly Lock _syncRoot = new Lock ( ) ;
21
22
22
23
private readonly int strongReferenceCount ;
23
24
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections ;
3
3
using System . Runtime . Serialization ;
4
+ using System . Threading ;
4
5
5
6
namespace NHibernate . Util
6
7
{
@@ -23,7 +24,7 @@ namespace NHibernate.Util
23
24
public class SoftLimitMRUCache : IDeserializationCallback
24
25
{
25
26
private const int DefaultStrongRefCount = 128 ;
26
- private readonly object _syncRoot = new object ( ) ;
27
+ private readonly Lock _syncRoot = new Lock ( ) ;
27
28
28
29
private readonly int strongReferenceCount ;
29
30
You can’t perform that action at this time.
0 commit comments