You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by pm...@apache.org on 2014/10/17 10:21:58 UTC
svn commit: r1632504 -
/qpid/trunk/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp
Author: pmoravec
Date: Fri Oct 17 08:21:58 2014
New Revision: 1632504
URL: http://svn.apache.org/r1632504
Log:
QPID-6157: linearstore: segfault when 2 journals request new journal file from empty EFP
Modified:
qpid/trunk/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp?rev=1632504&r1=1632503&r2=1632504&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp Fri Oct 17 08:21:58 2014
@@ -173,10 +173,11 @@ efpDataSize_kib_t EmptyFilePool::dataSiz
// --- protected functions ---
+// WARNING: this method needs to be called under the scope of emptyFileListMutex_ lock
void EmptyFilePool::createEmptyFile() {
std::string efpfn = getEfpFileName();
if (overwriteFileContents(efpfn)) {
- pushEmptyFile(efpfn);
+ emptyFileList_.push_back(efpfn);
}
}
@@ -207,16 +208,11 @@ bool EmptyFilePool::overwriteFileContent
std::string EmptyFilePool::popEmptyFile() {
std::string emptyFileName;
- bool isEmpty = false;
- {
- slock l(emptyFileListMutex_);
- isEmpty = emptyFileList_.empty();
- }
- if (isEmpty) {
- createEmptyFile();
- }
{
slock l(emptyFileListMutex_);
+ if (emptyFileList_.empty()) {
+ createEmptyFile();
+ }
emptyFileName = emptyFileList_.front();
emptyFileList_.pop_front();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org