 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Shea Martin Guest
|
Posted: Mon Sep 29, 2003 6:16 pm Post subject: protecting access to std::map |
|
|
I have multiple threads that need access to single std::map. Currently
I am using mutex's to regulate ANY access to the list.
My questionion is, is it safe to have multiple threads READING the list
at the same time, so long as they don't alter it?
~S
|
|
| Back to top |
|
 |
joe@invalid.address Guest
|
Posted: Mon Sep 29, 2003 6:23 pm Post subject: Re: protecting access to std::map |
|
|
Shea Martin <smartin (AT) arcis (DOT) com> writes:
| Quote: | I have multiple threads that need access to single std::map.
Currently I am using mutex's to regulate ANY access to the list.
My questionion is, is it safe to have multiple threads READING the
list at the same time, so long as they don't alter it?
|
Theoretically, unless there's a thread writing to it as well.
Try posting this question to comp.programming.threads
Joe
|
|
| Back to top |
|
 |
Fletcher Glenn Guest
|
Posted: Mon Sep 29, 2003 11:52 pm Post subject: Re: protecting access to std::map |
|
|
[email]joe (AT) invalid (DOT) addr[/email]ess wrote:
| Quote: | Shea Martin <smartin (AT) arcis (DOT) com> writes:
I have multiple threads that need access to single std::map.
Currently I am using mutex's to regulate ANY access to the list.
My questionion is, is it safe to have multiple threads READING the
list at the same time, so long as they don't alter it?
Theoretically, unless there's a thread writing to it as well.
Try posting this question to comp.programming.threads
Joe
|
I would have to agree with this answer. Many std::map's are
implemented as an AVL tree under the covers. It would not
do to well to be doing a read-only walk down a tree when the
pointers begin shifting around.
--
Fletcher Glenn
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|