Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
780a87bc
Commit
780a87bc
authored
Oct 15, 2015
by
Jeremy Meng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Volatile-related build errors for other non-dnxcore projects.
parent
39cc2a79
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
17 deletions
+54
-17
StackExchange.Redis.StrongName.csproj
StackExchange.Redis/StackExchange.Redis.StrongName.csproj
+1
-0
StackExchange.Redis.csproj
StackExchange.Redis/StackExchange.Redis.csproj
+1
-0
VolatileWrapper.cs
...hange.Redis/StackExchange/Redis/Compat/VolatileWrapper.cs
+29
-0
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+2
-2
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+1
-1
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+7
-7
RedisValue.cs
StackExchange.Redis/StackExchange/Redis/RedisValue.cs
+6
-6
ServerEndPoint.cs
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
+1
-1
StackExchange.Redis_Net40.StrongName.csproj
...e.Redis_Net40/StackExchange.Redis_Net40.StrongName.csproj
+3
-0
StackExchange.Redis_Net40.csproj
StackExchange.Redis_Net40/StackExchange.Redis_Net40.csproj
+3
-0
No files found.
StackExchange.Redis/StackExchange.Redis.StrongName.csproj
View file @
780a87bc
...
...
@@ -81,6 +81,7 @@
<ItemGroup>
<Compile
Include=
"StackExchange\Redis\Aggregate.cs"
/>
<Compile
Include=
"StackExchange\Redis\ClientType.cs"
/>
<Compile
Include=
"StackExchange\Redis\Compat\VolatileWrapper.cs"
/>
<Compile
Include=
"StackExchange\Redis\ConcurrentProfileStorageCollection.cs"
/>
<Compile
Include=
"StackExchange\Redis\ConnectionMultiplexer.Profiling.cs"
>
<DependentUpon>
ConnectionMultiplexer.cs
</DependentUpon>
...
...
StackExchange.Redis/StackExchange.Redis.csproj
View file @
780a87bc
...
...
@@ -75,6 +75,7 @@
<ItemGroup>
<Compile
Include=
"StackExchange\Redis\Aggregate.cs"
/>
<Compile
Include=
"StackExchange\Redis\ClientType.cs"
/>
<Compile
Include=
"StackExchange\Redis\Compat\VolatileWrapper.cs"
/>
<Compile
Include=
"StackExchange\Redis\ConcurrentProfileStorageCollection.cs"
/>
<Compile
Include=
"StackExchange\Redis\ConnectionMultiplexer.Profiling.cs"
>
<DependentUpon>
ConnectionMultiplexer.cs
</DependentUpon>
...
...
StackExchange.Redis/StackExchange/Redis/Compat/VolatileWrapper.cs
0 → 100644
View file @
780a87bc
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
StackExchange.Redis
{
internal
static
class
VolatileWrapper
{
public
static
int
Read
(
ref
int
location
)
{
#if !NETCORE
return
System
.
Threading
.
Thread
.
VolatileRead
(
ref
location
);
#else
return
System
.
Threading
.
Volatile
.
Read
(
ref
location
);
#endif
}
public
static
void
Write
(
ref
int
address
,
int
value
)
{
#if !NETCORE
System
.
Threading
.
Thread
.
VolatileWrite
(
ref
address
,
value
);
#else
System
.
Threading
.
Volatile
.
Write
(
ref
address
,
value
);
#endif
}
}
}
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
780a87bc
...
...
@@ -941,11 +941,11 @@ private void OnHeartbeat()
internal
long
LastHeartbeatSecondsAgo
{
get
{
if
(
pulse
==
null
)
return
-
1
;
return
unchecked
(
Environment
.
TickCount
-
Volatile
.
Read
(
ref
lastHeartbeatTicks
))
/
1000
;
return
unchecked
(
Environment
.
TickCount
-
Volatile
Wrapper
.
Read
(
ref
lastHeartbeatTicks
))
/
1000
;
}
}
internal
static
long
LastGlobalHeartbeatSecondsAgo
{
get
{
return
unchecked
(
Environment
.
TickCount
-
Volatile
.
Read
(
ref
lastGlobalHeartbeatTicks
))
/
1000
;
}
}
{
get
{
return
unchecked
(
Environment
.
TickCount
-
Volatile
Wrapper
.
Read
(
ref
lastGlobalHeartbeatTicks
))
/
1000
;
}
}
internal
CompletionManager
UnprocessableCompletionManager
{
get
{
return
unprocessableCompletionManager
;
}
}
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
780a87bc
...
...
@@ -394,7 +394,7 @@ internal void OnHeartbeat(bool ifConnectedOnly)
switch
(
state
)
{
case
(
int
)
State
.
Connecting
:
int
connectTimeMilliseconds
=
unchecked
(
Environment
.
TickCount
-
Volatile
.
Read
(
ref
connectStartTicks
));
int
connectTimeMilliseconds
=
unchecked
(
Environment
.
TickCount
-
Volatile
Wrapper
.
Read
(
ref
connectStartTicks
));
if
(
connectTimeMilliseconds
>=
multiplexer
.
RawConfig
.
ConnectTimeout
)
{
Trace
(
"Aborting connect"
);
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
780a87bc
...
...
@@ -94,7 +94,7 @@ public PhysicalConnection(PhysicalBridge bridge)
public
void
BeginConnect
(
TextWriter
log
)
{
Volatile
.
Write
(
ref
firstUnansweredWriteTickCount
,
0
);
Volatile
Wrapper
.
Write
(
ref
firstUnansweredWriteTickCount
,
0
);
var
endpoint
=
this
.
bridge
.
ServerEndPoint
.
EndPoint
;
multiplexer
.
Trace
(
"Connecting..."
,
physicalName
);
...
...
@@ -114,7 +114,7 @@ public long LastWriteSecondsAgo
{
get
{
return
unchecked
(
Environment
.
TickCount
-
Volatile
.
Read
(
ref
lastWriteTickCount
))
/
1000
;
return
unchecked
(
Environment
.
TickCount
-
Volatile
Wrapper
.
Read
(
ref
lastWriteTickCount
))
/
1000
;
}
}
...
...
@@ -194,9 +194,9 @@ public void RecordConnectionFailed(ConnectionFailureType failureType, ref Socket
if
(
isCurrent
&&
Interlocked
.
CompareExchange
(
ref
failureReported
,
1
,
0
)
==
0
)
{
managerState
=
SocketManager
.
ManagerState
.
RecordConnectionFailed_ReportFailure
;
int
now
=
Environment
.
TickCount
,
lastRead
=
Volatile
.
Read
(
ref
lastReadTickCount
),
lastWrite
=
Volatile
.
Read
(
ref
lastWriteTickCount
),
lastBeat
=
Volatile
.
Read
(
ref
lastBeatTickCount
);
int
unansweredRead
=
Volatile
.
Read
(
ref
firstUnansweredWriteTickCount
);
int
now
=
Environment
.
TickCount
,
lastRead
=
Volatile
Wrapper
.
Read
(
ref
lastReadTickCount
),
lastWrite
=
VolatileWrapper
.
Read
(
ref
lastWriteTickCount
),
lastBeat
=
Volatile
Wrapper
.
Read
(
ref
lastBeatTickCount
);
int
unansweredRead
=
Volatile
Wrapper
.
Read
(
ref
firstUnansweredWriteTickCount
);
var
exMessage
=
new
StringBuilder
(
failureType
+
" on "
+
Format
.
ToString
(
bridge
.
ServerEndPoint
.
EndPoint
)
+
"/"
+
connectionType
);
var
data
=
new
List
<
Tuple
<
string
,
string
>>
...
...
@@ -904,7 +904,7 @@ private bool ProcessReadBytes(int bytesRead)
Interlocked
.
Exchange
(
ref
lastReadTickCount
,
Environment
.
TickCount
);
// reset unanswered write timestamp
Volatile
.
Write
(
ref
firstUnansweredWriteTickCount
,
0
);
Volatile
Wrapper
.
Write
(
ref
firstUnansweredWriteTickCount
,
0
);
ioBufferBytes
+=
bytesRead
;
multiplexer
.
Trace
(
"More bytes available: "
+
bytesRead
+
" ("
+
ioBufferBytes
+
")"
,
physicalName
);
...
...
@@ -1067,7 +1067,7 @@ RawResult TryParseResult(byte[] buffer, ref int offset, ref int count)
public
void
CheckForStaleConnection
(
ref
SocketManager
.
ManagerState
managerState
)
{
int
firstUnansweredWrite
;
firstUnansweredWrite
=
Volatile
.
Read
(
ref
firstUnansweredWriteTickCount
);
firstUnansweredWrite
=
Volatile
Wrapper
.
Read
(
ref
firstUnansweredWriteTickCount
);
DebugEmulateStaleConnection
(
ref
firstUnansweredWrite
);
...
...
StackExchange.Redis/StackExchange/Redis/RedisValue.cs
View file @
780a87bc
...
...
@@ -714,9 +714,9 @@ public bool TryParse(out double val)
}
}
#if DNXCORE50
internal
static
class
ReflectionExtensions
{
#if DNXCORE50
internal
static
TypeCode
GetTypeCode
(
this
Type
type
)
{
if
(
type
==
null
)
return
TypeCode
.
Empty
;
...
...
@@ -750,11 +750,11 @@ internal static TypeCode GetTypeCode(this Type type)
{
typeof
(
uint
),
TypeCode
.
UInt32
},
{
typeof
(
ulong
),
TypeCode
.
UInt64
},
};
}
#else
internal
static
TypeCode
GetTypeCode
(
this
Type
type
)
{
return
type
.
GetTypeCode
();
}
internal
static
TypeCode
GetTypeCode
(
this
Type
type
)
{
return
type
.
GetTypeCode
();
}
#endif
}
}
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
View file @
780a87bc
...
...
@@ -484,7 +484,7 @@ internal void OnFullyEstablished(PhysicalConnection connection)
internal
int
LastInfoReplicationCheckSecondsAgo
{
get
{
return
unchecked
(
Environment
.
TickCount
-
Volatile
.
Read
(
ref
lastInfoReplicationCheckTicks
))
/
1000
;
}
get
{
return
unchecked
(
Environment
.
TickCount
-
Volatile
Wrapper
.
Read
(
ref
lastInfoReplicationCheckTicks
))
/
1000
;
}
}
private
EndPoint
masterEndPoint
;
...
...
StackExchange.Redis_Net40/StackExchange.Redis_Net40.StrongName.csproj
View file @
780a87bc
...
...
@@ -85,6 +85,9 @@
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\ClientType.cs"
>
<Link>
ClientType.cs
</Link>
</Compile>
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\Compat\VolatileWrapper.cs"
>
<Link>
VolatileWrapper.cs
</Link>
</Compile>
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\ConcurrentProfileStorageCollection.cs"
/>
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.Profiling.cs"
>
<DependentUpon>
ConnectionMultiplexer.cs
</DependentUpon>
...
...
StackExchange.Redis_Net40/StackExchange.Redis_Net40.csproj
View file @
780a87bc
...
...
@@ -82,6 +82,9 @@
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\ClientType.cs"
>
<Link>
ClientType.cs
</Link>
</Compile>
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\Compat\VolatileWrapper.cs"
>
<Link>
VolatileWrapper.cs
</Link>
</Compile>
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\ConcurrentProfileStorageCollection.cs"
/>
<Compile
Include=
"..\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.Profiling.cs"
>
<DependentUpon>
ConnectionMultiplexer.cs
</DependentUpon>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment