void ScanAsyncFile::close() { FileMultiError errout; soft_close(errout); if( +errout ) { Printf(Exception,"CCore::ScanAsyncFile::close() : #;",errout); } }
void BinaryFile::close() { FileMultiError errout; soft_close(errout); if( +errout ) { Printf(Exception,"CCore::BinaryFile::close() : #;",errout); } }
void threadedfilebuf::operator()() { std::streamsize data_to_write = 0; while(true) { if(is_pipe) { try { if(SigState::I().sig_callbacks.at(SIGPIPE).value) { soft_close(); return; } } catch(std::out_of_range & e) { // std::cout << "Please register a SIGPIPE handler for your writer" << std::endl; } } { boostd::unique_lock<boostd::mutex> lock(update_mutex); while( mem_size == 0 ) { if(!should_run) return; cond_queued.wait(lock); } data_to_write = (mem_start < mem_end) ? mem_end - mem_start : mem_max_size - mem_start; } std::streamsize bytes_written = file.sputn(mem_buffer + mem_start, data_to_write ); { boostd::unique_lock<boostd::mutex> lock(update_mutex); mem_size -= bytes_written; mem_start += bytes_written; if(mem_start == mem_max_size) mem_start = 0; } cond_dequeued.notify_all(); } }
ScanAsyncFile::~ScanAsyncFile() { if( is_opened ) { FileMultiError errout; soft_close(errout); if( +errout ) { Printf(NoException,"CCore::ScanAsyncFile::~ScanAsyncFile() : #;",errout); } } }
PrintFile::~PrintFile() { if( isOpened() ) { FileMultiError errout; soft_close(errout); if( +errout ) { Printf(NoException,"CCore::PrintFile::~PrintFile() : #;",errout); } } }
void threadedfilebuf::force_close() { soft_close(); close(); }