Backport Win32 LevelDB env from C++0x to C++
Since the gitian mingw compiler doesn't support C++0x yet.
This commit is contained in:
parent
9d503a7285
commit
9f56678fce
4 changed files with 5 additions and 5 deletions
|
@ -112,7 +112,7 @@ case "$TARGET_OS" in
|
||||||
OS_WINDOWS_CROSSCOMPILE)
|
OS_WINDOWS_CROSSCOMPILE)
|
||||||
PLATFORM=OS_WINDOWS
|
PLATFORM=OS_WINDOWS
|
||||||
COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_WINDOWS -DLEVELDB_PLATFORM_WINDOWS -DBOOST_THREAD_USE_LIB"
|
COMMON_FLAGS="-fno-builtin-memcmp -D_REENTRANT -DOS_WINDOWS -DLEVELDB_PLATFORM_WINDOWS -DBOOST_THREAD_USE_LIB"
|
||||||
PLATFORM_CXXFLAGS="-std=c++0x"
|
PLATFORM_CXXFLAGS=""
|
||||||
PLATFORM_LDFLAGS=""
|
PLATFORM_LDFLAGS=""
|
||||||
PLATFORM_SHARED_CFLAGS=""
|
PLATFORM_SHARED_CFLAGS=""
|
||||||
PLATFORM_SOURCES="port/port_win.cc util/env_boost.cc util/win_logger.cc"
|
PLATFORM_SOURCES="port/port_win.cc util/env_boost.cc util/win_logger.cc"
|
||||||
|
|
|
@ -134,7 +134,7 @@ AtomicPointer::AtomicPointer(void* v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* AtomicPointer::Acquire_Load() const {
|
void* AtomicPointer::Acquire_Load() const {
|
||||||
void * p = nullptr;
|
void * p = NULL;
|
||||||
InterlockedExchangePointer(&p, rep_);
|
InterlockedExchangePointer(&p, rep_);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ enum InitializationState
|
||||||
|
|
||||||
void InitOnce(OnceType* once, void (*initializer)()) {
|
void InitOnce(OnceType* once, void (*initializer)()) {
|
||||||
|
|
||||||
static_assert(Uninitialized == LEVELDB_ONCE_INIT, "Invalid uninitialized state value");
|
assert(Uninitialized == LEVELDB_ONCE_INIT);
|
||||||
|
|
||||||
InitializationState state = static_cast<InitializationState>(InterlockedCompareExchange(once, Running, Uninitialized));
|
InitializationState state = static_cast<InitializationState>(InterlockedCompareExchange(once, Running, Uninitialized));
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class AtomicPointer {
|
||||||
private:
|
private:
|
||||||
void * rep_;
|
void * rep_;
|
||||||
public:
|
public:
|
||||||
AtomicPointer() : rep_(nullptr) { }
|
AtomicPointer() : rep_(NULL) { }
|
||||||
explicit AtomicPointer(void* v);
|
explicit AtomicPointer(void* v);
|
||||||
void* Acquire_Load() const;
|
void* Acquire_Load() const;
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ class PosixEnv : public Env {
|
||||||
|
|
||||||
boost::interprocess::file_lock fl(fname.c_str());
|
boost::interprocess::file_lock fl(fname.c_str());
|
||||||
BoostFileLock * my_lock = new BoostFileLock();
|
BoostFileLock * my_lock = new BoostFileLock();
|
||||||
my_lock->fl_ = std::move(fl);
|
fl.swap(my_lock->fl_);
|
||||||
if (!my_lock->fl_.try_lock()) {
|
if (!my_lock->fl_.try_lock()) {
|
||||||
return Status::IOError("database already in use: could not acquire exclusive lock");
|
return Status::IOError("database already in use: could not acquire exclusive lock");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue