parent
e2b5dce3e3
commit
5761f103e1
|
@ -1,6 +1,6 @@
|
|||
#include "db-sqlite3.h"
|
||||
#include <stdexcept>
|
||||
#include <unistd.h> // for usleep
|
||||
#include "porting.h"
|
||||
#include "types.h"
|
||||
|
||||
#define BLOCKPOSLIST_STATEMENT "SELECT pos, rowid FROM blocks"
|
||||
|
@ -58,7 +58,7 @@ const DB::BlockPosList &DBSQLite3::getBlockPosList() {
|
|||
sqlite3_int64 rowid = sqlite3_column_int64(m_blockPosListStatement, 1);
|
||||
m_BlockPosList.push_back(BlockPos(blocknum, rowid));
|
||||
} else if (result == SQLITE_BUSY) // Wait some time and try again
|
||||
usleep(10000);
|
||||
sleepMs(10);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ DB::Block DBSQLite3::getBlockOnPos(const BlockPos &pos)
|
|||
m_blocksReadCount++;
|
||||
break;
|
||||
} else if (result == SQLITE_BUSY) { // Wait some time and try again
|
||||
usleep(10000);
|
||||
sleepMs(10);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include "porting.h"
|
||||
#include "TileGenerator.h"
|
||||
#include "PixelAttributes.h"
|
||||
#include "util.h"
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef _PORTING_H
|
||||
#define _PORTING_H
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#define sleepMs(x) Sleep(x)
|
||||
|
||||
#else
|
||||
|
||||
#include <unistd.h>
|
||||
#define sleepMs(x) usleep(x*1000)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define strcasecmp(a, b) _stricmp(a, b)
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _PORTING_H
|
Loading…
Reference in New Issue