Ignore:
Timestamp:
Sep 17, 2012, 1:12:53 AM (11 years ago)
Author:
Peter
Message:

merge release 0.9 into trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/yat/random/random.cc

    r2804 r2838  
    2424#include "yat/statistics/Histogram.h"
    2525#include "yat/utility/Exception.h"
     26
     27#include <boost/thread/locks.hpp>
    2628
    2729#include <cassert>
     
    9395    if (!rng)
    9496      throw utility::GSL_error("RNG failed to allocate memory");
     97    boost::unique_lock<boost::mutex> lock(mutex_);
    9598    gsl_rng_set(rng, seed_);
    9699    // bump seed to avoid subsequent gsl_rng to be identical
     
    98101    // rng_ owns rng and takes care of deallocation
    99102    rng_.reset(rng);
    100   }
     103  } // lock is released here
    101104
    102105
    103106  void RNG::seed(unsigned long s) const
    104107  {
     108    boost::unique_lock<boost::mutex> lock(mutex_);
    105109    gsl_rng_set(rng(),s);
    106110    seed_ = s+1;
    107   }
     111  } // lock is released here
    108112
    109113
Note: See TracChangeset for help on using the changeset viewer.