|
Boost Users : |
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2005-04-14 01:30:39
Manges, Ross G <Ross.G.Manges <at> boeing.com> writes:
> > 2. The comparison predicate you're passing is not correct (i.e. it
> > does not implement a strict weak ordering.)
> OK, this is possible. I'm using a function object. What exactly does it
> mean to implement strict weak ordering? I need to search the
> documentation again...
You've got to implement semantics equivalent to that of
the < relationship between numbers:
http://www.sgi.com/tech/stl/StrictWeakOrdering.html
> > 6. You haven't
> > selected a multithreaded version of the runtime library.
> I need to investigate this; what 'runtime library' are you referring to?
>
The C/C++ standard library. I'm no GCC expert, check -pthreads
and related compiler options.
I've got an idea that might help to determine where the
problem is actually happening. Invariant checking is
performed at the end of every write member function
(in your case, insert()). There are two possibilities:
1. Invariant is OK before calling insert() and the insertion
itself breaks it.
2. The invariant is already broken by the time you call
insert() (by some side effect in some other thread, for
instance.)
To determine whether we're dealing with 1 or 2, could you
please do the following?
* In line 513 of multi_index_container.hpp there's a protected
member function called check_invariant_:
void check_invariant_()const
{
BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_());
}
* Make this member function public by modifying
multi_index_container.hpp (you might want to backup the
header first):
public:
void check_invariant_()const
{
BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_());
}
* Now, in the piece of your code where the insert asserts,
add a precheck of the invariant:
m.check_invariant_(); // point A
m.insert(...); // point B
* Run your test till the assert fires. Is it in point
A or B? If A, then most likely you're somehow modifying
the elements in some other thread. Get the idea?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net