Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- From: "h.wulff" <zuhause@xxxxxxx>
- Date: Sun, 30 Mar 2008 19:24:37 +0200
Igor Tandetnik wrote:
"h.wulff" <zuhause@xxxxxxx> wrote in message
news:fsod03$pc8$1@xxxxxxxxxxxxxx
The release version of my shell extension works fine. But the debug
version crashes on calling erase(), clear() or remove()
Wait a minute. Your subject claims you have a read-only list shared between two thread. But now you say you are calling methods on it that modify the list. So which way is it? It is, of course, illegal to modify a list while another thread is traversing it.
Ok, let me explain the situation more precisely:
I start the scan thread *after* I've added the list of files to be scanned. So before starting the scan thread only one thread is accessing/modifying the std::list container.
When the scan thread is started the std::list container isn't modified in any way. Both threads are iterating through the std::list container. So at this time the std::list container is read-only to both threads.
I call erase(), clear() or remove() (where it crashes) in my destructor when my shell extension is unloaded. At this time the scan thread has already done its work. So only one thread is accessing the std::list container.
I hope the situation is a bit clearer now.
--
h.wulff
.
- References:
- Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- From: h.wulff
- Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- From: Igor Tandetnik
- Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- Prev by Date: Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- Next by Date: Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- Previous by thread: Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- Next by thread: Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
- Index(es):
Relevant Pages
|