threads: added recoll_threadinit calls to block signals

This commit is contained in:
Jean-Francois Dockes 2012-11-23 13:36:05 +01:00
parent f52ca5f95c
commit 8a18c7bdd8
2 changed files with 7 additions and 1 deletions

View file

@ -44,6 +44,7 @@
#include "wipedir.h" #include "wipedir.h"
#include "fileudi.h" #include "fileudi.h"
#include "cancelcheck.h" #include "cancelcheck.h"
#include "rclinit.h"
// When using extended attributes, we have to use the ctime. // When using extended attributes, we have to use the ctime.
// This is quite an expensive price to pay... // This is quite an expensive price to pay...
@ -361,6 +362,7 @@ void FsIndexer::makesig(const struct stat *stp, string& out)
#ifdef IDX_THREADS #ifdef IDX_THREADS
void *FsIndexerDbUpdWorker(void * fsp) void *FsIndexerDbUpdWorker(void * fsp)
{ {
recoll_threadinit();
FsIndexer *fip = (FsIndexer*)fsp; FsIndexer *fip = (FsIndexer*)fsp;
WorkQueue<DbUpdTask*> *tqp = &fip->m_dwqueue; WorkQueue<DbUpdTask*> *tqp = &fip->m_dwqueue;
DebugLog::getdbl()->setloglevel(fip->m_loglevel); DebugLog::getdbl()->setloglevel(fip->m_loglevel);
@ -384,6 +386,7 @@ void *FsIndexerDbUpdWorker(void * fsp)
void *FsIndexerInternfileWorker(void * fsp) void *FsIndexerInternfileWorker(void * fsp)
{ {
recoll_threadinit();
FsIndexer *fip = (FsIndexer*)fsp; FsIndexer *fip = (FsIndexer*)fsp;
WorkQueue<InternfileTask*> *tqp = &fip->m_iwqueue; WorkQueue<InternfileTask*> *tqp = &fip->m_iwqueue;
DebugLog::getdbl()->setloglevel(fip->m_loglevel); DebugLog::getdbl()->setloglevel(fip->m_loglevel);

View file

@ -56,6 +56,7 @@ using namespace std;
#include "ptmutex.h" #include "ptmutex.h"
#include "termproc.h" #include "termproc.h"
#include "expansiondbs.h" #include "expansiondbs.h"
#include "rclinit.h"
// Recoll index format version is stored in user metadata. When this change, // Recoll index format version is stored in user metadata. When this change,
// we can't open the db and will have to reindex. // we can't open the db and will have to reindex.
@ -793,6 +794,7 @@ static const string cstr_nc("\n\r\x0c");
#ifdef IDX_THREADS #ifdef IDX_THREADS
void *DbUpdWorker(void* vdbp) void *DbUpdWorker(void* vdbp)
{ {
recoll_threadinit();
Db *dbp = (Db *)vdbp; Db *dbp = (Db *)vdbp;
WorkQueue<DbUpdTask*> *tqp = &(dbp->m_ndb->m_wqueue); WorkQueue<DbUpdTask*> *tqp = &(dbp->m_ndb->m_wqueue);
DebugLog::getdbl()->setloglevel(dbp->m_ndb->m_loglevel); DebugLog::getdbl()->setloglevel(dbp->m_ndb->m_loglevel);
@ -1170,7 +1172,8 @@ bool Db::Native::addOrUpdateWrite(const string& udi, const string& uniterm,
void Db::waitUpdIdle() void Db::waitUpdIdle()
{ {
m_ndb->m_wqueue.waitIdle(); m_ndb->m_wqueue.waitIdle();
LOGDEB(("Db::waitUpdIdle: total work %ll mS\n", m_ndb->m_totalworkus/1000)); LOGDEB(("Db::waitUpdIdle: total work %lld mS\n",
m_ndb->m_totalworkus/1000));
} }
#endif #endif