For Programmers: Free Programming Magazines  


Home > Archive > VC STL > March 2005 > list<t>:: iterator thread safety?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author list<t>:: iterator thread safety?
Corey Wirun

2005-03-02, 4:08 pm

Hi All,

Can anyone give me insight if the list<T>::iterator is thread safe?

Thanks in Advance!
Corey.


Stephen Howe

2005-03-02, 4:08 pm

> Can anyone give me insight if the list<T>::iterator is thread safe?

It is not thread safe. No parts of the STL are thread safe.
But it is such that for node containers (list,set,map,multimap,multiset), an
iterator to a node remains valid while the node exists. Therefore providing
other threads are not changing the existence of the node, list<T>::iterator
set to a node should remain valid.

Stephen Howe


Corey Wirun

2005-03-02, 9:00 pm

Thanks Stephen!


"Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom> wrote in message
news:uMaYPV1HFHA.3588@TK2MSFTNGP14.phx.gbl...
>
> It is not thread safe. No parts of the STL are thread safe.
> But it is such that for node containers (list,set,map,multimap,multiset),

an
> iterator to a node remains valid while the node exists. Therefore

providing
> other threads are not changing the existence of the node,

list<T>::iterator
> set to a node should remain valid.
>
> Stephen Howe
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com