Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-09-06 11:14:40

condition.cpp does not compile when the macro NOMINMAX is not defined.

This program:

#include <iostream>
#include <boost/bind.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/tss.hpp>

static boost::mutex m;
static boost::thread_specific_ptr<int> p;

void print(int n)
  p.reset(new int(n));
  boost::mutex::scoped_lock lock(m);
  std::cout << n << '\n';

int main()
  for(int i = 0; i < 8; ++i)
    boost::thread(boost::bind(print, i));

sometimes prints 1, 2, ..., 7 (note absence of 0) and sometimes locks up my
machine. (I'm using MSVC.) This happens only in Release builds, not in
Debug; I suspect that 0 is not printed because the catch(...) handler in
thread.cpp eats the access violation. The problem is probably in call_once.

Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at, gregod at, cpdaniel at, john at