help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shared_ptr<> is blocking...


From: Paulo Matos
Subject: shared_ptr<> is blocking...
Date: 7 Feb 2006 20:14:36 -0800
User-agent: G2/0.2

Hi all,

I've started to use shared_ptr<> around my program quite recently.
However, I've been experiencing wierd things like my problem getting
blocked in what seems to be a mutex. I've stepped my program in gdb.
The function ends and starts to call some functions probably to destroy
the object however, it blocks and never returns. This is the last line
where it is blocking:
__gthread_mutex_lock (mutex=0x80ff86c) at gthr-default.h:510
510         return pthread_mutex_lock (mutex);

Is there any tips for what's happening to me? Is this usual? What can I
do to avoid it?

Cheers,
Paulo Matos

A more complete trace since the function exits is as follows:


94          for(unsigned int pos = 0; pos < sol.size()-1; ++pos) { /*
AFTER THIS LINE, MY FUNCTION EXITS */

std::vector<double, std::allocator<double> >::size (this=0x80ffd1c) at
stl_vector.h:403
403          { return size_type(end() - begin()); }

std::vector<double, std::allocator<double> >::begin (this=0x80ffd1c) at
stl_vector.h:343
343           { return const_iterator (this->_M_impl._M_start); }

__normal_iterator (this=0xbfa1e8e4, __i=@0xbfa1e8c0) at
stl_iterator.h:603
603           __normal_iterator(const _Iterator& __i) : _M_current(__i)
{ }

0x08054715 in std::vector<double, std::allocator<double> >::begin
(this=0x80ffd1c) at stl_vector.h:343
343           { return const_iterator (this->_M_impl._M_start); }

0x0805517a in std::vector<double, std::allocator<double> >::size
(this=0x80ffd1c) at stl_vector.h:403
403           { return size_type(end() - begin()); }

std::vector<double, std::allocator<double> >::end (this=0x80ffd1c) at
stl_vector.h:361
361           { return const_iterator (this->_M_impl._M_finish); }

__normal_iterator (this=0xbfa1e8e0, __i=@0xbfa1e8c0) at
stl_iterator.h:603
603           __normal_iterator(const _Iterator& __i) : _M_current(__i)
{ }

0x080546ea in std::vector<double, std::allocator<double> >::end
(this=0x80ffd1c) at stl_vector.h:361
361           { return const_iterator (this->_M_impl._M_finish); }

0x08055195 in std::vector<double, std::allocator<double> >::size
(this=0x80ffd1c) at stl_vector.h:403
403           { return size_type(end() - begin()); }

__gnu_cxx::operator-<double const*, double const*, std::vector<double,
std::allocator<double> > > (__lhs=@0xbfa1e8f4, __rhs=@0xbfa1e8f0) at
stl_iterator.h:759
759         { return __lhs.base() - __rhs.base(); }

__gnu_cxx::__normal_iterator<double const*, std::vector<double,
std::allocator<double> > >::base (this=0xbfa1e8f4) at
stl_iterator.h:666
666          { return _M_current; }

0x08055142 in __gnu_cxx::operator-<double const*, double const*,
std::vector<double, std::allocator<double> > > (__lhs=@0xbfa1e8f4,
__rhs=@0xbfa1e8f0)
    at stl_iterator.h:759
759         { return __lhs.base() - __rhs.base(); }

__gnu_cxx::__normal_iterator<double const*, std::vector<double,
std::allocator<double> > >::base (this=0xbfa1e8f0) at
stl_iterator.h:666
666           { return _M_current; }

0x08055151 in __gnu_cxx::operator-<double const*, double const*,
std::vector<double, std::allocator<double> > > (__lhs=@0xbfa1e8f4,
__rhs=@0xbfa1e8f0)
    at stl_iterator.h:759
759         { return __lhs.base() - __rhs.base(); }

0x080551b0 in std::vector<double, std::allocator<double> >::size
(this=0x80ffd1c) at stl_vector.h:403
403           { return size_type(end() - begin()); }

esatDiffLogic::solve (this=0x80fdca8, m=@0xbfa1eb10) at
esatdifflogic.cc:111
111       }

~shared_ptr (this=0xbfa1e984) at boost_shared_ptr.h:474
474       {

~shared_count (this=0xbfa1e988) at boost_shared_ptr.h:265
265         if (_M_pi != 0)

266           _M_pi->release();

std::tr1::_Sp_counted_base::release (this=0x80ff860) at
boost_shared_ptr.h:145
145         if (__gnu_cxx::__exchange_and_add(&_M_use_count, -1) == 1)

147           dispose();

std::tr1::_Sp_counted_base_impl<std::pair<bool, std::vector<double,
std::allocator<double> > >*, std::tr1::_Sp_deleter<std::pair<bool,
std::vector<double, std::allocator<double> > > > >::dispose
(this=0x80ff860) at boost_shared_ptr.h:203
203         _M_del(_M_ptr);

std::tr1::_Sp_deleter<std::pair<bool, std::vector<double,
std::allocator<double> > > >::operator() (this=0x80ff888, p=0x80ffd18)
at boost_shared_ptr.h:94
94          { delete p; }

~pair (this=0x80ffd18) at stl_pair.h:69
69          {

~vector (this=0x80ffd1c) at stl_vector.h:273
273           { std::_Destroy(this->_M_impl._M_start,
this->_M_impl._M_finish,

std::_Vector_base<double, std::allocator<double> >::get_allocator
(this=0x80ffd1c) at stl_vector.h:94
94            { return *static_cast<const _Alloc*>(&this->_M_impl); }

allocator (this=0xbfa1e897, __a=@0x80ffd1c) at allocator.h:100
100           : ___glibcxx_base_allocator<_Tp>(__a) { }

new_allocator (this=0xbfa1e897) at new_allocator.h:69
69            new_allocator(const new_allocator&) throw() { }

0x08053e42 in allocator (this=0xbfa1e897, __a=@0x80ffd1c) at
allocator.h:100
100           : ___glibcxx_base_allocator<_Tp>(__a) { }

0x08053e5f in std::_Vector_base<double, std::allocator<double>
>::get_allocator (this=0x80ffd1c) at stl_vector.h:94
94            { return *static_cast<const _Alloc*>(&this->_M_impl); }

0x0805467e in ~vector (this=0x80ffd1c) at stl_vector.h:273
273           { std::_Destroy(this->_M_impl._M_start,
this->_M_impl._M_finish,

std::_Destroy<double*, double> (__first=0x80ffd30, __last=0x80ffd50) at
stl_construct.h:182
182           _Destroy(__first, __last);

std::_Destroy<double*> (__first=0x80ffd30, __last=0x80ffd50) at
stl_construct.h:155
155           std::__destroy_aux(__first, __last,
_Has_trivial_destructor());

std::__destroy_aux<double*> () at stl_construct.h:137
137         { }

0x0805464a in std::_Destroy<double*> (__first=0x80ffd30,
__last=0x80ffd50) at stl_construct.h:155
155           std::__destroy_aux(__first, __last,
_Has_trivial_destructor());

0x08054664 in std::_Destroy<double*, double> (__first=0x80ffd30,
__last=0x80ffd50) at stl_construct.h:182
182           _Destroy(__first, __last);

0x0805469f in ~vector (this=0x80ffd1c) at stl_vector.h:273
273           { std::_Destroy(this->_M_impl._M_start,
this->_M_impl._M_finish,

~allocator (this=0xbfa1e897) at allocator.h:105
105           ~allocator() throw() { }

~new_allocator (this=0xbfa1e897) at new_allocator.h:74
74            ~new_allocator() throw() { }

0x08053df3 in ~allocator (this=0xbfa1e897) at allocator.h:105
105           ~allocator() throw() { }

0x080546aa in ~vector (this=0x80ffd1c) at stl_vector.h:273
273           { std::_Destroy(this->_M_impl._M_start,
this->_M_impl._M_finish,

~_Vector_base (this=0x80ffd1c) at stl_vector.h:109
109           { _M_deallocate(this->_M_impl._M_start,
this->_M_impl._M_end_of_storage

std::_Vector_base<double, std::allocator<double> >::_M_deallocate
(this=0x80ffd1c, __p=0x80ffd30, __n=4) at stl_vector.h:122
122             if (__p)

123               _M_impl.deallocate(__p, __n);

__gnu_cxx::new_allocator<double>::deallocate (this=0x80ffd1c,
__p=0x80ffd30) at new_allocator.h:96
96            { ::operator delete(__p); }

0x080545dd in std::_Vector_base<double, std::allocator<double>
>::_M_deallocate (this=0x80ffd1c, __p=0x80ffd30, __n=4) at stl_vector.h:123
123               _M_impl.deallocate(__p, __n);

0x08054616 in ~_Vector_base (this=0x80ffd1c) at stl_vector.h:109
109           { _M_deallocate(this->_M_impl._M_start,
this->_M_impl._M_end_of_storage

~_Vector_impl (this=0x80ffd1c) at stl_vector.h:80
80            {

~allocator (this=0x80ffd1c) at allocator.h:105
105           ~allocator() throw() { }

~new_allocator (this=0x80ffd1c) at new_allocator.h:74
74            ~new_allocator() throw() { }

0x08053e07 in ~allocator (this=0x80ffd1c) at allocator.h:105
105           ~allocator() throw() { }

0x0805428b in ~_Vector_impl (this=0x80ffd1c) at stl_vector.h:80
80            {

0x08054621 in ~_Vector_base (this=0x80ffd1c) at stl_vector.h:109
109           { _M_deallocate(this->_M_impl._M_start,
this->_M_impl._M_end_of_storage

0x080546b5 in ~vector (this=0x80ffd1c) at stl_vector.h:273
273           { std::_Destroy(this->_M_impl._M_start,
this->_M_impl._M_finish,

0x08054734 in ~pair (this=0x80ffd18) at stl_pair.h:69
69          {

0x08054753 in std::tr1::_Sp_deleter<std::pair<bool, std::vector<double,
std::allocator<double> > > >::operator() (this=0x80ff888, p=0x80ffd18)
at boost_shared_ptr.h:94
94          { delete p; }

0x08056c44 in std::tr1::_Sp_counted_base_impl<std::pair<bool,
std::vector<double, std::allocator<double> > >*,
std::tr1::_Sp_deleter<std::pair<bool, std::vector<double,
std::allocator<double> > > > >::dispose (this=0x80ff860) at
boost_shared_ptr.h:203
203         _M_del(_M_ptr);

std::tr1::_Sp_counted_base::release (this=0x80ff860) at
boost_shared_ptr.h:148
148           __glibcxx_mutex_lock(_M_mutex);

__gthread_mutex_lock (mutex=0x80ff86c) at gthr-default.h:509
509       if (__gthread_active_p ())

__gthread_active_p () at gthr-default.h:111
111       return __gthread_active_ptr != 0;

112     }

__gthread_mutex_lock (mutex=0x80ff86c) at gthr-default.h:510
510         return pthread_mutex_lock (mutex);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]