C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

protecting access to std::map

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Shea Martin
Guest





PostPosted: Mon Sep 29, 2003 6:16 pm    Post subject: protecting access to std::map Reply with 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?

~S

Back to top
joe@invalid.address
Guest





PostPosted: Mon Sep 29, 2003 6:23 pm    Post subject: Re: protecting access to std::map Reply with quote



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





PostPosted: Mon Sep 29, 2003 11:52 pm    Post subject: Re: protecting access to std::map Reply with quote





[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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.