Boost logo

Boost Users :

From: Michael Garriss (mdg_at_[hidden])
Date: 2004-12-16 14:49:57


Michael Garriss said the following on 12/16/04 10:46:
> from libs/thread/mutex.cpp in boost 1.31, around line 211:
>
> void mutex::do_lock()
> {
> int res = 0;
> res = pthread_mutex_lock(&m_mutex);
> if (res == EDEADLK) throw lock_error();
> assert(res == 0);
> }
>
> that last assert is failing for me. pthread_mutex_lock is returning 22
> which if it's from sys/errno.h is EINVAL or "Invalid argument". any ideas?
>
> i built boost 1.31 on hpux 11.11 with a gcc from hp. some info:
>
> > gcc -v
> Reading specs from /usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/specs
> Configured with:
> /scratch/zack/pkgbuild/3.3.1/hpux-11/gcc-3.3.3/configure
> --enable-languages=c,c++ --enable-threads=posix --disable-nls
> --with-gnu-as --without-gnu-ld --with-as=/usr/local/bin/as
> --prefix=/usr/local
> Thread model: posix
> gcc version 3.3.3
>
> > uname -a
> HP-UX unknown B.11.11 U 9000/800 180901557 unlimited-user license
>
> thanks,
> mike
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

ok, this breaks with an assertrion failure:

  #include <boost/thread/thread.hpp>
  #include <boost/thread/mutex.hpp>
  #include <iostream>
  struct count {
      boost::mutex mutex;
      count (int) { }
      void operator()() {
          boost::mutex::scoped_lock lock(mutex);
          std::cout << "Here" << std::endl;
      }
  };
  int main(void) {
    count c(1);
    boost::thread thrd1(boost::ref(c));
    thrd1.join();
    return 0;
  }

but this does not:
  #include <boost/thread/thread.hpp>
  #include <boost/thread/mutex.hpp>
  boost::mutex mutex;
  struct count {
      count (int) { }
      void operator()() { boost::mutex::scoped_lock lock(mutex); }
  };
  int main(void) {
    boost::thread thrd1(count(0));
    thrd1.join();
    return 0;
  }

--------------------------------------------------------------------------

--- mgarriss_at_hpux-test01 ~/test ---
g++ -I /home/mgarriss/dev/tp-compiled/include/boost-1_31_0 -pthread
test.cxx
/home/mgarriss/dev/tp-compiled/lib/boost-1_31_0/libboost_thread-gcc-mt.a
/usr/local/hppa2.0w-hp-hpux11.11/bin/nm: a.out: no symbols
--- mgarriss_at_hpux-test01 ~/test ---
./a.out
Assertion failed: _EX, file
/home/mgarriss/dev/tp-sources/boost_1_31_0/libs/thread/src/mutex.cpp,
line 211
ABORT instruction (core dumped)

it also breaks on making mutex a static class member. so in summary it
only works (i think) if the mutex is a member var.

Mike


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