Re: gdb help: debugging a segfault in boost::shared_ptr
- From: Joe Seigh <jseigh_01@xxxxxxxxxx>
- Date: Wed, 06 Dec 2006 11:48:26 -0500
phear wrote:
Putting a lock on IDatabaseAdapter.GetAdapter() did not help. Locking[...]
Instance::GetEntry fixed it, but this ofcourse defies the purpose of
multi-threading.
I have tried using normal pointers instead, and although a lot more
rare, it still segfaults occasionally.
I am currently following a lead from valgrind, but I'm not going to
hold my breath just yet.
It's not a problem with shared_ptr or with the debugger. The "lock-free"
stuff in shared_ptr is a red herring. It's an implementation issue to make
it thread-safe and could just have easily been lock based and is lock
based on some platforms. Thread-safe means that shared_ptr handle
internally shared data safely, i.e. the reference count. It does not
mean it is atomically thread-safe like Java pointers and that you
don't need some form of external synchronization if the pointers are
shared.
If you want to see what an atomically thread-safe refcount pointer looks
like, take a look at atomic_ptr in
http://atomic-ptr-plus.sourceforge.net/
We can't give you too much specific advice on how to solve your
problem since we know few specifics on what you are trying
to accomplish.
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software. .
- Follow-Ups:
- References:
- gdb help: debugging a segfault in boost::shared_ptr
- From: phear . dude
- Re: gdb help: debugging a segfault in boost::shared_ptr
- From: Joe Seigh
- Re: gdb help: debugging a segfault in boost::shared_ptr
- From: phear
- Re: gdb help: debugging a segfault in boost::shared_ptr
- From: phear
- gdb help: debugging a segfault in boost::shared_ptr
- Prev by Date: Re: gdb help: debugging a segfault in boost::shared_ptr
- Next by Date: Re: Writing a daemon that can be used with service ?
- Previous by thread: Re: gdb help: debugging a segfault in boost::shared_ptr
- Next by thread: Re: gdb help: debugging a segfault in boost::shared_ptr
- Index(es):
Relevant Pages
|