mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
add mutex to getBlock
This commit is contained in:
parent
5c4a968781
commit
ceb31baf97
|
@ -137,7 +137,7 @@ char * Reader::getBlock( uint32_t address, vector< char > & chunk )
|
|||
// Read and decompress the chunk
|
||||
{
|
||||
// file.seek( offsets[ chunkIdx ] );
|
||||
|
||||
Mutex::Lock _( file.lock );
|
||||
auto bytes = file.map( offsets[ chunkIdx ], 8 );
|
||||
auto qBytes = QByteArray::fromRawData( reinterpret_cast< char * >(bytes), 8 );
|
||||
QDataStream in( qBytes );
|
||||
|
|
2
file.hh
2
file.hh
|
@ -9,6 +9,7 @@
|
|||
#include <vector>
|
||||
#include <QFile>
|
||||
#include "ex.hh"
|
||||
#include "mutex.hh"
|
||||
|
||||
/// A simple wrapper over FILE * operations with added write-buffering,
|
||||
/// used for non-Qt parts of code.
|
||||
|
@ -44,6 +45,7 @@ class Class
|
|||
void open( char const * filename, char const * mode ) ;
|
||||
|
||||
public:
|
||||
Mutex lock;
|
||||
|
||||
Class( char const * filename, char const * mode ) ;
|
||||
|
||||
|
|
Loading…
Reference in a new issue