-
CoStream 无缓存 Pipe Stream
翻译 maninwest@Codeforge 作者:Sergey Nozhenko@CodeProject介绍:CoStream 是的 PipeStream 无缓存替代选择。背景在生产者/消费者模式下,如果我们知道一个消费者确定要读取stream 读到结束或者如果不能读到结束就处理,那么同步stream 就不需要维护自己的内部缓存,完全依赖于 Read 方法调用者的缓存。在Read 方法中,CoStream 保存到目标缓存的引用并等待,直至完成。而 write 方法从源缓存中复制数据到目标缓存,会给读取者发送信号缓存已准备就绪或者需要等待期 Read 调用(如果来源缓存中有未消耗的数据剩下或者返回到Writer 调用者)。使用代码CoStream 不能在单个话题中使用。应该至少有两个,读取和写入话题。两者都需要关闭(或处理)stream,一边对方可以继续到结束。测试程序在 XmlDocument 中加载了一些 xml 文件。然后将其写入到 CoStream 的实例Static CoStream costream = new TestCoStream();
static string outpath;
static void Main(string[] args)
{
// ...
XmlDocument doc = new XmlDocument();
doc.Load(args[0]);
outpath = args[1];
var reading_thread = new Thread(ReaderBody);
reading_thread.Start();
using (var pipe = XmlWriter.Create(costream, new XmlWriterSettings { CloseOutput = true }))
doc.Save(pipe);
reading_thre
- 2022-03-17 17:34:17下载
- 积分:1
-
开发usb硬件相关文件,挺好用的,是转载过来的
开发usb硬件相关文件,挺好用的,是转载过来的-Development usb hardware-related documents, very good use, and is reprinted from the
- 2023-07-23 19:55:03下载
- 积分:1
-
农村水电费记帐录入,统计汇总,打印输出收费单据。可预存费用,也可欠费统计。...
农村水电费记帐录入,统计汇总,打印输出收费单据。可预存费用,也可欠费统计。-Rural utilities account entry, statistical summary, printouts charging documents. Costs can be stored can also be Arrearage statistics.
- 2022-02-27 08:53:15下载
- 积分:1
-
结构应力计算(转贴)有限单元法基本原理和数值方法》一书的源程序...
结构应力计算(转贴)有限单元法基本原理和数值方法》一书的源程序-structural stress (04) finite element method and the basic tenets of Numerical Methods, "a book of the source
- 2023-06-25 00:45:04下载
- 积分:1
-
电力系统标准101规约
电力系统标准101规约-power system standard 101 Statute
- 2022-09-15 16:45:04下载
- 积分:1
-
通讯协议,视频、会议电视采用的主流通讯协议,目前在NGN中广泛应用...
通讯协议,视频、会议电视采用的主流通讯协议,目前在NGN中广泛应用-communications protocols, video, television meeting the mainstream communications protocols, in the widespread application of NGN
- 2022-02-28 20:53:07下载
- 积分:1
-
PC机控制系统程序,使用汇编,仅供大家参考参考
PC机控制系统程序,使用汇编,仅供大家参考参考-PC control system, the use of the compilation, for your information
- 2022-04-11 03:14:19下载
- 积分:1
-
这个是老师要叫的作业,会很有用哦,输入一段程序,就会判断词法类型...
这个是老师要叫的作业,会很有用哦,输入一段程序,就会判断词法类型-this is the teacher called to the operation, it will be very useful, oh, the importation of some procedures, it will judge the type morphology
- 2023-02-10 09:25:04下载
- 积分:1
-
用于水文领域,在调洪演算方面有很多用途,如皮尔逊三型曲线...
用于水文领域,在调洪演算方面有很多用途,如皮尔逊三型曲线-hydrology in the areas of flood calculus has many uses, such as Pearson three-curve
- 2022-01-22 07:43:20下载
- 积分:1
-
转换。H C++头文件ASM公司
Convert .H C++ headers to ASM .INC
- 2022-01-31 03:01:16下载
- 积分:1