Win32:匿名管道上的事务
TransactNamedPipe 函数 的文档声称“此参数也可以是句柄到一个匿名管道,由 CreatePipe 函数返回。” 这意味着可以在匿名管道上使用事务。据我了解,事务是读/写操作,匿名管道要么是读,要么是写——这对我来说没有意义。
- 真的可以使用匿名管道进行事务吗?
- 如果是,怎么办?例如,我应该将通过调用 CreatePipe 获得的两个句柄中的哪一个传递给 TransactNamedPipe?
Documentation for TransactNamedPipe Function claims that "This parameter can also be a handle to an anonymous pipe, as returned by the CreatePipe function."
This would mean that it is possible to use transactions on anonymous pipes. As I understand it transactions are read/write operations and anonymous pipes are either read or write - it doesn't make sense to me.
- Is it really possible to use transactions with anonymous pipes?
- If yes, how? For example which of the two handles obtained from call to CreatePipe should I pass to TransactNamedPipe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
警告:我还没有尝试过这个。然而 CreatePipe 的 MSDN 文档包含确凿的证据来说明为什么这可能有效。这些文档目前已经非常成熟 - 命名管道是一种非常早期的 Windows 传输 - 如果这是不正确的,我会感到惊讶。
结合您上面提供的报价,这表明这是可行的。不确定您将使用 CreatePipe 中的哪个句柄(读取或写入) - 也许两者都可以工作,因为这是一个在幕后的单个双工命名管道。
Caveat: I have not tried this. However the MSDN docs for CreatePipe contain corroborative evidence for why this might work. These docs are very mature at this point - named pipes were a very early Windows transport - and it would surprise me if this is incorrect.
This, in combination with the quote you provided above, suggests this will work. Not sure what handle (read or write) from
CreatePipe
you would use - maybe either will work, since this is a single duplex named pipe under the covers.