Differences From Artifact [4879805b8b]:
- File
src/OFStream.m
— part of check-in
[f218986f51]
at
2018-12-18 14:14:25
on branch trunk
— Use OFData instead of a buffer for async writes
This avoids the entire problem of keeping the buffer alive until the
write finished. (user: js, size: 38513) [annotate] [blame] [check-ins using]
To Artifact [9ea61c11ef]:
- File src/OFStream.m — part of check-in [6b35b78f94] at 2018-12-18 16:41:11 on branch trunk — Add -[OFStream asyncWriteString:] (user: js, size: 40249) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | (OFStream <OFReadyForWritingObserving> *)self; [OFRunLoop of_addAsyncWriteForStream: stream data: data mode: runLoopMode delegate: _delegate]; } # ifdef OF_HAVE_BLOCKS - (void)asyncWriteData: (OFData *)data | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | (OFStream <OFReadyForWritingObserving> *)self; [OFRunLoop of_addAsyncWriteForStream: stream data: data mode: runLoopMode delegate: _delegate]; } - (void)asyncWriteString: (OFString *)string { [self asyncWriteString: string encoding: OF_STRING_ENCODING_UTF_8 runLoopMode: of_run_loop_mode_default]; } - (void)asyncWriteString: (OFString *)string encoding: (of_string_encoding_t)encoding { [self asyncWriteString: string encoding: encoding runLoopMode: of_run_loop_mode_default]; } - (void)asyncWriteString: (OFString *)string encoding: (of_string_encoding_t)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode { OFStream <OFReadyForWritingObserving> *stream = (OFStream <OFReadyForWritingObserving> *)self; [OFRunLoop of_addAsyncWriteForStream: stream string: string encoding: encoding mode: runLoopMode delegate: _delegate]; } # ifdef OF_HAVE_BLOCKS - (void)asyncWriteData: (OFData *)data block: (of_stream_async_write_data_block_t)block { [self asyncWriteData: data runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncWriteData: (OFData *)data runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_stream_async_write_data_block_t)block { OFStream <OFReadyForWritingObserving> *stream = (OFStream <OFReadyForWritingObserving> *)self; [OFRunLoop of_addAsyncWriteForStream: stream data: data mode: runLoopMode block: block]; } - (void)asyncWriteString: (OFString *)string block: (of_stream_async_write_string_block_t)block { [self asyncWriteString: string encoding: OF_STRING_ENCODING_UTF_8 runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncWriteString: (OFString *)string encoding: (of_string_encoding_t)encoding block: (of_stream_async_write_string_block_t)block { [self asyncWriteString: string encoding: encoding runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncWriteString: (OFString *)string encoding: (of_string_encoding_t)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_stream_async_write_string_block_t)block { OFStream <OFReadyForWritingObserving> *stream = (OFStream <OFReadyForWritingObserving> *)self; [OFRunLoop of_addAsyncWriteForStream: stream string: string encoding: encoding mode: runLoopMode block: block]; } # endif #endif - (void)writeInt8: (uint8_t)int8 { [self writeBuffer: (char *)&int8 length: 1]; |
︙ | ︙ |