Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14380
| Date | Tue, 21 Feb 2012 16:52:18 +0100 |
|---|---|
| From | Willy <gruppi@willygroup.org> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.c++ |
| Subject | Some doubts about Mutex |
| Content-Type | text/plain; charset=ISO-8859-15; format=flowed |
| Content-Transfer-Encoding | 7bit |
| NNTP-Posting-Host | $$_jwdkl$snn0l.extreme.x-privat.org |
| Message-ID | <4f43bdbd@extreme.x-privat.org> (permalink) |
| Organization | X-Privat.Org NNTP Server - http://www.x-privat.org |
| Lines | 43 |
| X-Authenticated-User | $$0x8zgs0_a373od7n$mxc |
| X-Complaints-To | abuse@x-privat.org |
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!newsfeed.x-privat.org!x-privat.org!not-for-mail |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:14380 |
Show key headers only | View raw
Hi,
I've just started to study parallel programming on Linux and I've
already some doubts about Mutex.
I've a generic data, which I want to access with mutually exclusion
(1read or 1read).
data
Then I've read/write method:
read_data(...), write_data(...)
Then I've other two method like:
operation_1(...)
{
...
operation_2(...)
...
}
operation_2(...)
{
...
read_data(...) //[1]
...
write_data(...) //[2]
...
}
Initially I had put between mutex only the read_data and write_data
methods, then I've realized that this way can bring some trouble because
if some process/thread call operation_2, some other process/thread can
call write_data between [1] and [2] screwing up all.
Which is the better way to solve this situation?
Thanks
--
*Willy* - *Contatti*: http://snipurl.com/contatti
* *FAQ* di /it-alt.comp.software.mozilla/: http://www.FAQmozilla.org
* *Gratuiki* - Software Free: http://gratuiki.willygroup.org
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
Some doubts about Mutex Willy <gruppi@willygroup.org> - 2012-02-21 16:52 +0100 Re: Some doubts about Mutex Paavo Helde <myfirstname@osa.pri.ee> - 2012-02-21 23:58 -0600
csiph-web