示例#1
0
文件: rdchem.cpp 项目: ASKCOS/rdkit
 void write(char c) { // enable thread safe logging
   static boost::thread_specific_ptr< std::string > buffer;
   if( !buffer.get() ) {
     buffer.reset( new std::string );
   }
   (*buffer.get()) += c;
   if (c == '\n') {
     // Python IO is not thread safe, so grab the GIL
     PyGILState_STATE gstate;
     gstate = PyGILState_Ensure();
     PySys_WriteStderr("%s", (prefix + (*buffer.get())).c_str());
     PyGILState_Release(gstate);
     buffer->clear();
   }
 }