Delete a list item from a separate thread safe?
- From: "Bruce." <noone@xxxxxxxxxxx>
- Date: Tue, 4 Mar 2008 16:49:29 -0600
I've got a list that will be accessed by multiple threads. The list will be
protected by a critical section.
However, I'm wondering about this case. Say one thread is using an iterator
to step through the list. The stepping from one list item to the next will
be in a critical section (but not while using the list item).
Say the loop is on the 3rd item when a separate thread deletes the 3rd item.
The deletion will be done inside the same critical section.
Essentially this means thread 1 will be processing item 3 while it is being
deleted by thread 2. Then thread 1 will increment the iterator to step from
item 3 (now deleted) to item 4 (now 3).
Will the iterator in thread 1 still step correctly if the item it's stepping
from has been deleted?
Bruce.
.
- Follow-Ups:
- Re: Delete a list item from a separate thread safe?
- From: Doug Harrison [MVP]
- Re: Delete a list item from a separate thread safe?
- From: Igor Tandetnik
- Re: Delete a list item from a separate thread safe?
- Prev by Date: Re: Why "Access Violent" throw when insert pair object into std::map
- Next by Date: Re: Delete a list item from a separate thread safe?
- Previous by thread: Re: Why "Access Violent" throw when insert pair object into std::map
- Next by thread: Re: Delete a list item from a separate thread safe?
- Index(es):
Relevant Pages
|