只读取变量与线程同步 [英] Only reading of variable vs. thread synchronisation
问题描述
只读取(从不写)变量需要线程同步吗?
感谢您的帮助?
PS。
有人知道Visual C ++新闻组吗?
Hapa写道:
只读取(从不写)变量需要线程同步吗?
感谢您的帮助?
这取决于你是否取决于读取的最新值。
cpthreads是一个更好的问题,在那里问了类似的问题
最近检查存档。
-
Ian Collins。
" Hapa" < Ha ** @ apah.org写信息
新闻:g2 ************* @ news.t-online.com ...
只读取(从不写)变量需要线程
同步吗?
感谢您的帮助?
PS。
有谁知道Visual C ++新闻组?
microsoft.public.vc.language
-
Scott McPhillips [VC ++ MVP ]
6月4日上午11:32,Hapa < H ... @ apah.orgwrote:
只读取(从不写)变量需要线程
同步?
从技术上讲,它取决于系统,但在Posix下(并且我也认为Windows也是b $ b),只要没有线程写入对象,
不需要同步。一旦威胁写入,所有
访问(即使是从不写的线程)必须是
同步。
-
James Kanze(GABI软件)电子邮件:ja ********* @ gmail.com
Conseils eninformatiqueorientéeobjet/
Beratung in objektorientierter Datenverarbeitung
9placeSémard,78210 St.-Cyr-l''coco,France,+ 33(0)1 30 23 00 34
Does only reading (never writing) of a variable need thread synchronisation?
Thanks for help?
PS.
Anybody knows a Visual C++ news group?
Hapa wrote:Does only reading (never writing) of a variable need thread synchronisation?
Thanks for help?
That depends on whether you depend on the value read being up to date.
c.p.threads is a better place to ask, a similar question was asked there
recently check the archive.
--
Ian Collins.
"Hapa" <Ha**@apah.orgwrote in message
news:g2*************@news.t-online.com...Does only reading (never writing) of a variable need thread
synchronisation?
Thanks for help?
PS.
Anybody knows a Visual C++ news group?
microsoft.public.vc.language
--
Scott McPhillips [VC++ MVP]
On Jun 4, 11:32 am, "Hapa" <H...@apah.orgwrote:Does only reading (never writing) of a variable need thread
synchronisation?Technically, it depends on the system, but under Posix (and I
think Windows as well), as long as no thread writes the object,
no synchronization is needed. As soon as any threat writes, all
accesses (even from threads which don''t write) must be
synchronized.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34
这篇关于只读取变量与线程同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!