Skip to content

Commit 1a0cfae

Browse files
committed
monitor的参数要用引用类型
1 parent 30bface commit 1a0cfae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

PacketSender.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public bool send(MemoryStream stream)
7777
}
7878
}
7979

80-
int t_spos = Interlocked.Add(ref _spos, 0);
80+
int t_spos = _spos;
8181
int space = 0;
8282
int tt_wpos = _wpos % _buffer.Length;
8383
int tt_spos = t_spos % _buffer.Length;
@@ -107,7 +107,7 @@ public bool send(MemoryStream stream)
107107
Array.Copy(stream.data(), stream.rpos + remain, _buffer, 0, expect_total - _buffer.Length);
108108
}
109109

110-
Interlocked.Add(ref _wpos, dataLength);
110+
_wpos += dataLength;
111111

112112
if (!_sending)
113113
{

0 commit comments

Comments
 (0)