| 388 | } |
| 389 | |
| 390 | ChangeLog::~ChangeLog() |
| 391 | { |
| 392 | m_shutdown = true; |
| 393 | |
| 394 | m_workingSemaphore.release(); |
| 395 | m_cleanupSemaphore.enter(); |
| 396 | |
| 397 | try |
| 398 | { |
| 399 | LockGuard guard(this); |
| 400 | |
| 401 | if (unlinkSelf()) |
| 402 | { |
| 403 | // We're the last owner going away, so mark the active segment as full. |
| 404 | // Then attempt archiving the full segments. |
| 405 | |
| 406 | switchActiveSegment(); |
| 407 | |
| 408 | // At this point checkouts are disabled, thus it's safe |
| 409 | // to iterate through the segments without restarts |
| 410 | |
| 411 | for (const auto segment : m_segments) |
| 412 | { |
| 413 | if (segment->getState() == SEGMENT_STATE_FULL) |
| 414 | archiveSegment(segment); |
| 415 | } |
| 416 | |
| 417 | m_sharedMemory->removeMapFile(); |
| 418 | } |
| 419 | } |
| 420 | catch (const Exception&) |
| 421 | {} // no-op |
| 422 | |
| 423 | clearSegments(); |
| 424 | } |
| 425 | |
| 426 | void ChangeLog::initSharedFile() |
| 427 | { |
nothing calls this directly
no test coverage detected