Ignore:
Timestamp:
05/11/17 16:12:23 (7 years ago)
Author:
yushan
Message:

log OK with threads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/src/log.cpp

    r523 r1128  
    11#include "log.hpp" 
     2#include <string> 
     3#include <iostream> 
     4#include <string> 
    25 
    36namespace xios 
    47{ 
     8 
     9  std::filebuf* info_FB[10]; 
     10 
     11 
    512  CLog info("info") ; 
    613  CLog report("report") ; 
    714  CLog error("error", cerr.rdbuf()) ; 
     15 
     16   
     17  CLog& CLog::operator()(int l) 
     18    { 
     19      if (l<=level) 
     20      { 
     21        omp_set_lock( &mutex ); 
     22        //rdbuf(strBuf_);  
     23        rdbuf(strBuf_array[omp_get_thread_num()]);  
     24        *this<<"-> "<<name<<" : " ; 
     25        omp_unset_lock( &mutex ); 
     26      } 
     27      else rdbuf(NULL) ; 
     28      return *this; 
     29    } 
     30 
     31 
     32 
     33  int test_omp_rank; 
     34  #pragma omp threadprivate(test_omp_rank) 
     35 
     36   
     37 
    838} 
Note: See TracChangeset for help on using the changeset viewer.