mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-28 03:44:07 +00:00
Make loggingMutex nonrecursive
A recursive mutex is less efficient and clearly not needed here.
This commit is contained in:
parent
d1ff165a65
commit
a020ebc4b8
|
@ -1,14 +1,15 @@
|
||||||
/* This file is (c) 2013 Abs62
|
/* This file is (c) 2013 Abs62
|
||||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "mutex.hh"
|
|
||||||
#include "gddebug.hh"
|
#include "gddebug.hh"
|
||||||
|
|
||||||
QFile * logFilePtr;
|
QFile * logFilePtr;
|
||||||
static QTextCodec * utf8Codec;
|
static QTextCodec * utf8Codec;
|
||||||
static Mutex loggingMutex;
|
static QMutex loggingMutex;
|
||||||
|
|
||||||
void gdWarning(const char *msg, ...)
|
void gdWarning(const char *msg, ...)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ QTextCodec *localeCodec = 0;
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
if( logFilePtr && logFilePtr->isOpen() )
|
||||||
{
|
{
|
||||||
Mutex::Lock _( loggingMutex );
|
QMutexLocker _( &loggingMutex );
|
||||||
|
|
||||||
if( utf8Codec == 0 )
|
if( utf8Codec == 0 )
|
||||||
utf8Codec = QTextCodec::codecForName( "UTF8" );
|
utf8Codec = QTextCodec::codecForName( "UTF8" );
|
||||||
|
@ -44,7 +45,7 @@ QTextCodec *localeCodec = 0;
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
if( logFilePtr && logFilePtr->isOpen() )
|
||||||
{
|
{
|
||||||
Mutex::Lock _( loggingMutex );
|
QMutexLocker _( &loggingMutex );
|
||||||
|
|
||||||
if( utf8Codec == 0 )
|
if( utf8Codec == 0 )
|
||||||
utf8Codec = QTextCodec::codecForName( "UTF8" );
|
utf8Codec = QTextCodec::codecForName( "UTF8" );
|
||||||
|
|
Loading…
Reference in a new issue