COM引用计数 - 线程安全 [英] COM reference counting - thread safety

查看:173
本文介绍了COM引用计数 - 线程安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个COM对象,它是必需的AddRef()和Release()方法是线程安全的 - 即,我必须使用原子操作我的参考计数吗?

If I have a COM object, is it required for the AddRef() and Release() methods to be thread-safe- i.e., that I have to use atomic operations for my ref count?

推荐答案

是的,如果你使用的是免费的线程模型,使用InterlockedIncrement()和InterlockedDecrement()来处理引用计数。

Yes, if you are using the free threaded aparement model, use InterlockedIncrement() and InterlockedDecrement() to handle the ref count.

这篇关于COM引用计数 - 线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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