Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > mutexes and con...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 11 Topic 43924 of 48020
Post > Topic >>

mutexes and const_iterators

by "Angus" <nospam@[EMAIL PROTECTED] > Mar 15, 2008 at 10:21 AM

Hello

I am using a map which holds a list of client connections (to a server).
When a client connects a client gets added to the map and also when a
client
disconnects.

In various parts of the code the map gets updated - the key is an int and
the value is a class.

As the map may be accessed by multiple threads I use a mutex to control
access - ie locking whenever an item is added or removed.

I have these questions:

1. Do I also need to lock if I just update and item?  I access the item
via
an iterator.

2. Do I need to lock if I simply access the map via a const_iterator?

Angus
 




 11 Posts in Topic:
mutexes and const_iterators
"Angus" <nos  2008-03-15 10:21:10 
Re: mutexes and const_iterators
Barry <dhb2000@[EMAIL   2008-03-15 05:50:33 
Re: mutexes and const_iterators
Kai-Uwe Bux <jkherciue  2008-03-15 09:20:32 
Re: mutexes and const_iterators
James Kanze <james.kan  2008-03-16 04:22:41 
Re: mutexes and const_iterators
Paavo Helde <nobody@[E  2008-03-15 12:57:33 
Re: mutexes and const_iterators
James Kanze <james.kan  2008-03-16 04:31:20 
Re: mutexes and const_iterators
Paavo Helde <nobody@[E  2008-03-16 08:33:57 
Re: mutexes and const_iterators
James Kanze <james.kan  2008-03-16 11:14:05 
Re: mutexes and const_iterators
Paavo Helde <nobody@[E  2008-03-16 17:07:51 
Re: mutexes and const_iterators
"Jim Langston"   2008-03-15 23:35:23 
Re: mutexes and const_iterators
James Kanze <james.kan  2008-03-16 04:17:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 8:53:25 CDT 2008.