MCPcopy Create free account
hub / github.com/KDE/labplot / close

Method close

src/3rdparty/vector_blf/src/Vector/BLF/File.cpp:102–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void File::close() {
103 /* check if file is open */
104 if (!is_open())
105 return;
106
107 /* read */
108 if (m_openMode & std::ios_base::in) {
109 /* finalize compressedFileThread */
110 m_compressedFileThreadRunning = false;
111 m_compressedFile.close();
112
113 /* finalize uncompressedFileThread */
114 m_uncompressedFileThreadRunning = false;
115 m_uncompressedFile.abort();
116
117 /* abort readWriteQueue */
118 m_readWriteQueue.abort();
119
120 /* finalize compressedFileThread */
121 if (m_compressedFileThread.joinable())
122 m_compressedFileThread.join();
123
124 /* finalize uncompressedFileThread */
125 if (m_uncompressedFileThread.joinable())
126 m_uncompressedFileThread.join();
127 }
128
129 /* write */
130 if (m_openMode & std::ios_base::out) {
131 /* set eof */
132 m_readWriteQueue.setFileSize(m_readWriteQueue.tellp()); // set eof
133
134 /* finalize uncompressedFileThread */
135 if (m_uncompressedFileThread.joinable())
136 m_uncompressedFileThread.join();
137 if (m_uncompressedFileThreadException) {
138 try{
139 std::rethrow_exception(m_uncompressedFileThreadException);
140 } catch(const std::exception &ex) {
141 std::cerr << "uncompressedFileThread exited with exception: " << ex.what() << std::endl;
142 }
143 }
144
145 /* finalize compressedFileThread */
146 if (m_compressedFileThread.joinable())
147 m_compressedFileThread.join();
148 if (m_compressedFileThreadException) {
149 try{
150 std::rethrow_exception(m_compressedFileThreadException);
151 } catch(const std::exception &ex) {
152 std::cerr << "compressedFileThread exited with exception: " << ex.what() << std::endl;
153 }
154 }
155
156 /* write restore points */
157 if (writeRestorePoints) {
158 /* create a new log container for it */
159 m_uncompressedFile.nextLogContainer();

Callers 2

mainFunction · 0.45
mainFunction · 0.45

Calls 6

nextLogContainerMethod · 0.80
seekpMethod · 0.80
abortMethod · 0.45
setFileSizeMethod · 0.45
tellpMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected