OK复制CRITICAL_SECTION? [英] OK to copy a CRITICAL_SECTION?

查看:163
本文介绍了OK复制CRITICAL_SECTION?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用一个CRITICAL_SECTION变量获得互斥。

One can use a CRITICAL_SECTION variable to get mutual exclusion.

我的问题是:CRITICAL_SECTION支持复制?如果我传递一个由价值到另一个线程,我知道肯定互斥是否行得通呢?

My question is: does CRITICAL_SECTION support copying? If I pass one by value to another thread, can I know for sure that mutual exclusion will work?

我也不会感到惊讶,如果答案是你不能这样做,但它会是不错的具有某种官方的确认。我没能找到一份声明中的文档中任何一种方式。

I wouldn't be surprised if the answer is "you cannot do that", but it'd be nice to have some sort of official confirmation. I wasn't able to find a statement either way in the documentation.

推荐答案

没有。 A CRITICAL_SECTION 无法复制。 MSDN这个国家明确的:

No. A CRITICAL_SECTION cannot be copied. MSDN states this explicitly:

一个关键节对象不能移动或复制。

A critical section object cannot be moved or copied.

这篇关于OK复制CRITICAL_SECTION?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆