Article View: borland.public.cppbuilder.nativeapi
Article #7571Re: Accessing same variable from multiple threads
From: Vladimir Afanasyev
Date: Thu, 20 Jan 2005 12:12
Date: Thu, 20 Jan 2005 12:12
13 lines
1881 bytes
1881 bytes
Frankly my first answer was critical section and semaphor. But I think that in easiest case no need to use synchronization. Really because one variable can be changed to some variables or structure via refactoring the using semephors and critical sections preferable. If think that better way will be if reading thread creates another thread that will have sole task - listen/watch for variables. This thread (in my opinion) must use semaphor for watching for variable(s). Besides it must lock some pages by VirtualLock, go to the higest priority and sleep/wait via WaitForSingleObject. This way it can track any changes of variable. Vladimir.
Technical Details
Message-ID:
<41efa03e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41edea6b@newsgroups.borland.com> <41ee3727$1@newsgroups.borland.com> <41ee742e$1@newsgroups.borland.com> <41ee8f57$1@newsgroups.borland.com> <41ee9bd1$1@newsgroups.borland.com> <41eea799$1@newsgroups.borland.com> <41eed116$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4809cdd9a7828fa7 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Vladimir Afanasyev" <avv@systema.kiev.ua> Sender: "Vladimir Afanasyev" <avv@systema.kiev.ua> Reply-To: "Vladimir Afanasyev" <avv@systema.kiev.ua> Subject: Re: Accessing same variable from multiple threads Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 83.218.237.46 X-Forwarded-For: unknown References: <41edea6b@newsgroups.borland.com> <41ee3727$1@newsgroups.borland.com> <41ee742e$1@newsgroups.borland.com> <41ee8f57$1@newsgroups.borland.com> <41ee9bd1$1@newsgroups.borland.com> <41eea799$1@newsgroups.borland.com> <41eed116$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <41efa03e$1@newsgroups.borland.com> Date: 20 Jan 2005 04:12:46 -0800 X-Trace: newsgroups.borland.com 1106223166 207.105.83.66 (20 Jan 2005 04:12:46 -0800) Lines: 13 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail