Changeset 457 for trunk/Include/Classes/System/IO/TextReader.ab
- Timestamp:
- Mar 6, 2008, 9:49:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/IO/TextReader.ab
r432 r457 36 36 ElseIf count < 0 Then 37 37 End If 38 Read = ReadImpl(buffer, index, count) 38 39 End Function 39 40 … … 80 81 End Function 81 82 /* 83 @brief 現在位置からストリームの終わりまで読み込む。 82 84 @date 2008/02/26 83 85 @auther Egtra … … 93 95 sb.Append(ch As StrChar) 94 96 Loop 97 End Function 98 99 Static Function Synchronized(reader As TextReader) As TextReader 95 100 End Function 96 101 … … 118 123 End Class 119 124 125 Namespace Detail 126 127 Class SynchronizedTextReader 128 Inherits TextReader 129 Public 130 Sub SynchronizedTextReader(reader As TextReader) 131 cs = New ActiveBasic.Windows.CriticalSection 132 base = reader 133 End Sub 134 135 Override Function Peek() As Long 136 ' Using lock = cs.Lock 137 Peek = base.Peek 138 ' End Using 139 End Function 140 141 Override Function Read() As Long 142 ' Using lock = cs.Lock 143 Read = base.Read 144 ' End Using 145 End Function 146 147 Override Function ReadLine() As String 148 ' Using lock = cs.Lock 149 ReadLine = base.ReadLine 150 ' End Using 151 End Function 152 153 Override Function ReadToEnd() As String 154 ' Using lock = cs.Lock 155 ReadToEnd = base.ReadToEnd 156 ' End Using 157 End Function 158 159 Protected 160 Override Sub Dispose(disposing As Boolean) 161 Dim s = Nothing As Stream 162 SetPointer(VarPtr(s) As *VoidPtr, InterlockedExchangePointer(ByVal VarPtr(base) As *VoidPtr, 0)) 163 If disposing Then 164 If Not ActiveBasic.IsNothing(s) Then 165 s.Dispose() 166 End If 167 cs.Dispose() 168 End If 169 End Sub 170 171 Override Function ReadImpl(buffer As *StrChar, index As Long, count As Long) As Long 172 ' Using lock = cs.Lock 173 ReadImpl = base.ReadImpl(buffer, index, count) 174 ' End Using 175 End Function 176 Private 177 cs As ActiveBasic.Windows.CriticalSection 178 base As TextReader 179 End Class 180 181 End Namespace 182 120 183 End NameSpace 121 184 End NameSpace
Note:
See TracChangeset
for help on using the changeset viewer.