-
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
-
图书信息管理系统
图书信息存放在文件中,提供文件的输入、输出等操作;要实现浏览功能;查询和排序功能要求实现查找操作(至少两种依据);还应该提供图书信息删除和修改的功能;另外还应该提供键盘式选择菜单以实现功能选择。
- 2022-02-02 08:53:09下载
- 积分:1
-
teach yourself C++ in 21 days
第五版
teach yourself C++ in 21 days
第五版-teach yourself C in the fifth edition of 21 days
- 2022-03-14 18:31:54下载
- 积分:1
-
一个有趣的魔方程序。vc++实现。有点意思
一个有趣的魔方程序。vc++实现。有点意思-?桓 鲇腥 ?的????绦???vc++ 实现 ??有点意?
- 2023-05-08 12:40:02下载
- 积分:1
-
四色算法的改进算法,针对四色算法的不足进行了相关改进。...
四色算法的改进算法,针对四色算法的不足进行了相关改进。-Four-color algorithm algorithm algorithm for four-color deficiencies were related to improve.
- 2022-04-06 16:22:01下载
- 积分:1
-
用VB写的一款小游戏,方式就像打地鼠一样,分级别速度。
用VB写的一款小游戏,方式就像打地鼠一样,分级别速度。-Written with VB a little game to play like a hamster the same way, sub-level of speed.
- 2022-09-29 08:25:02下载
- 积分:1
-
Porting the Simple Sockets Library Dr. Charles E. Campbell, Jr.
Porting the Simple Sockets Library Dr. Charles E. Campbell, Jr.
- 2023-07-12 15:20:03下载
- 积分:1
-
想给你女朋友一个惊喜吗?一个小程序让你实现这个愿望.粘贴到记事本里面,另存为,再把文件名的后缀名改为hta就OK了,效果自己双击就看的到,成功编辑以后,想关掉他...
想给你女朋友一个惊喜吗?一个小程序让你实现这个愿望.粘贴到记事本里面,另存为,再把文件名的后缀名改为hta就OK了,效果自己双击就看的到,成功编辑以后,想关掉他可以按ALT+F4 -Would like to give your girlfriend a surprise it? A small program allows you to realize this wish. Paste it into Notepad inside, Save As, and then the file name suffix changed the name hta on OK, and the effect of their own double-click on to see that the success of editing later, he would like to switch off can ALT+ F4
- 2022-01-22 11:33:58下载
- 积分:1
-
dos下的一个很好的俄罗斯方块内有详细注释
dos下的一个很好的俄罗斯方块内有详细注释-dos a good Russian block with detailed Notes
- 2023-08-04 17:55:03下载
- 积分:1
-
VC on the MFC
VC++关于MFC-VC on the MFC
- 2023-07-06 16:05:03下载
- 积分:1