Changeset 852b1ce in tol


Ignore:
Timestamp:
May 2, 2013, 10:52:54 AM (13 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
4acc8bd
Parents:
6fce577
Message:

refs #770, deshabilitamos el thread hasta tener una lib de boost que compile bien con tol en VC9.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@5759 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/bgrammar/oprimp.cpp

    r6fce577 r852b1ce  
    2222//#define TRACE_LEVEL 1
    2323
     24#define DONOT_USE_THREAD_PROFILE
     25
    2426#include <iostream>
    25 #include <boost/asio.hpp>
     27
     28#ifndef DONOT_USE_THREAD_PROFILE
    2629#include <boost/date_time/posix_time/posix_time.hpp>
    2730#include <boost/thread/thread.hpp>
    2831#include <boost/thread/shared_mutex.hpp>
    2932#include <boost/thread/locks.hpp>
     33#endif
    3034
    3135#if defined(_MSC_VER)
    … …  
    7983#ifdef Do_TolOprProfiler
    8084
     85#ifndef DONOT_USE_THREAD_PROFILE
    8186typedef boost::shared_mutex Lock;
    8287typedef boost::unique_lock< Lock > WriteLock;
    … …  
    8590Lock myLock;
    8691
     92#define WRITE_LOCK \
     93  WriteLock w_lock(myLock);
     94#define READ_LOCK \
     95  ReadLock r_lock(myLock);
     96
    8797void SampleProfiler();
     98#else
     99#define WRITE_LOCK
     100#define READ_LOCK
     101#endif
    88102
    89103//--------------------------------------------------------------------
    … …  
    111125  static BTolOprProfiler* ptrCurrentProfiler;
    112126  static size_t TickResolution;
     127
     128#ifndef DONOT_USE_THREAD_PROFILE
    113129  static boost::thread *ptrThread;
     130#endif
    114131
    115132  struct CalllingStr
    … …  
    283300  static void StartThread()
    284301  {
     302#ifndef DONOT_USE_THREAD_PROFILE
    285303    if (!BTolOprProfiler::ptrThread)
    286304      {
    287305      BTolOprProfiler::ptrThread = new boost::thread(&SampleProfiler);
    288306      }
     307#endif
    289308  }
    290309
    291310  static void StopThread()
    292311  {
     312#ifndef DONOT_USE_THREAD_PROFILE
    293313    if (BTolOprProfiler::ptrThread)
    294314      {
    … …  
    297317      BTolOprProfiler::ptrThread = NULL;
    298318      }
     319#endif
    299320  }
    300321
    … …  
    302323  {
    303324    // REVIEW: adquire an exclusive lock
    304     WriteLock w_lock(myLock);
     325    WRITE_LOCK;
    305326    BTolOprProfiler::ptrCurrentProfiler = profiler;
    306327    // REVIEW: release the lock (released when leaving scope
    … …  
    310331  {
    311332    // REVIEW: adquire an exclusive lock
    312     ReadLock r_lock(myLock);
     333    READ_LOCK;
    313334    return BTolOprProfiler::ptrCurrentProfiler;
    314335    // REVIEW: release the lock (released when leaving scope
    … …  
    318339  {
    319340    // REVIEW: adquire a lock
    320     WriteLock w_lock(myLock);
     341    WRITE_LOCK;
    321342    if (BTolOprProfiler::ptrCurrentProfiler)
    322343      {
    … …  
    330351  {
    331352    // REVIEW: adquire a lock
    332     WriteLock w_lock(myLock);
     353    WRITE_LOCK;
    333354    if (BTolOprProfiler::ptrCurrentProfiler)
    334355      {
    … …  
    344365  {
    345366    // REVIEW: adquire a lock
    346     ReadLock r_lock(myLock);
     367    READ_LOCK;
    347368    if (BTolOprProfiler::ptrCurrentProfiler)
    348369      {
    … …  
    356377  {
    357378    // REVIEW: adquire a lock
    358     WriteLock w_lock(myLock);
     379    WRITE_LOCK;
    359380    size_t previous = BTolOprProfiler::TickResolution;
    360381    BTolOprProfiler::TickResolution = resolution;
    … …  
    366387  {
    367388    // REVIEW: adquire a lock
    368     ReadLock r_lock(myLock);
     389    READ_LOCK;
    369390    return BTolOprProfiler::TickResolution;
    370391    // REVIEW: release the lock, released when leaving scope
    … …  
    558579void SampleProfiler()
    559580{
     581#ifndef DONOT_USE_THREAD_PROFILE
    560582  size_t resolution = BTolOprProfiler::GetTickResolution();
    561583  while(1)
    … …  
    565587    boost::this_thread::sleep(boost::posix_time::microseconds(resolution));
    566588    }
     589#endif
    567590}
    568591
    … …  
    603626//--------------------------------------------------------------------
    604627{
     628#ifndef DONOT_USE_THREAD_PROFILE
    605629  if (BTolOprProfiler::ptrThread)
    606630    {
    … …  
    609633    return;
    610634    }
     635#endif
    611636  double freq = Real(Arg(1));
    612637  BTolOprProfiler::enabled_ = 1;
    … …  
    641666BTolOprProfiler* BTolOprProfiler::ptrCurrentProfiler = NULL;
    642667size_t BTolOprProfiler::TickResolution = 1;
     668
     669#ifndef DONOT_USE_THREAD_PROFILE
    643670boost::thread *BTolOprProfiler::ptrThread = NULL;
     671#endif
    644672
    645673int BTolOprProfiler_Init() { return(BTolOprProfiler::Initialize()); }
Note: See TracChangeset for help on using the changeset viewer.