Hi Liu,

No, it is not thread safe. No implementation that I can think of is. The
assumption is that concurrency issues will be accounted for at a higher
level. A brute force solution would be to surround each insert/erase
with a mutex. A more elegant solution would be to use rw locks to allow
multiple reads, but only one write. If you've got 20+ threads, the rw
locks might be worth the aditional effort, but then again, it would
really depend on you access patterns. Do you have Unix Network
Programming Vol 1, by W. Richard Stevens? It's a great reference for
exactly what you seem to be doing.

Hope this helps,

Don

"Liu, Guangsheng" wrote:
> 
> Hi,
>   I have a problem with <map>. When I create more than 20 thread, map.find()
> starts to return end() which it should not.
> I am wondering the whole STL distributed by Red Hat multi_thread safe. If it
> is not, what is the alternative?
>   The following is info about OS and compiler (I have not installed anything
> particular).
>     Red Hat Linux 6.2
>     kernel version: 2.2.14
>     gcc 2.95.2
> 
>   Thanks
> 
> 
> _______________________________________________
> Redhat-devel-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to