|
a/src/common/rclinit.cpp |
|
b/src/common/rclinit.cpp |
|
... |
|
... |
20 |
#ifdef _WIN32
|
20 |
#ifdef _WIN32
|
21 |
#include "safewindows.h"
|
21 |
#include "safewindows.h"
|
22 |
#endif
|
22 |
#endif
|
23 |
#include <signal.h>
|
23 |
#include <signal.h>
|
24 |
#include <locale.h>
|
24 |
#include <locale.h>
|
25 |
#include <pthread.h>
|
|
|
26 |
#include <cstdlib>
|
25 |
#include <cstdlib>
|
27 |
#if !defined(PUTENV_ARG_CONST)
|
26 |
#if !defined(PUTENV_ARG_CONST)
|
28 |
#include <string.h>
|
27 |
#include <string.h>
|
29 |
#endif
|
28 |
#endif
|
|
|
29 |
|
|
|
30 |
#include <thread>
|
30 |
|
31 |
|
31 |
#include "log.h"
|
32 |
#include "log.h"
|
32 |
#include "rclconfig.h"
|
33 |
#include "rclconfig.h"
|
33 |
#include "rclinit.h"
|
34 |
#include "rclinit.h"
|
34 |
#include "pathut.h"
|
35 |
#include "pathut.h"
|
35 |
#include "rclutil.h"
|
36 |
#include "rclutil.h"
|
36 |
#include "unac.h"
|
37 |
#include "unac.h"
|
37 |
#include "smallut.h"
|
38 |
#include "smallut.h"
|
38 |
#include "execmd.h"
|
39 |
#include "execmd.h"
|
39 |
|
40 |
|
40 |
static pthread_t mainthread_id;
|
41 |
std::thread::id mainthread_id;
|
41 |
|
42 |
|
42 |
// Signal etc. processing. We want to be able to properly close the
|
43 |
// Signal etc. processing. We want to be able to properly close the
|
43 |
// index if we are currently writing to it.
|
44 |
// index if we are currently writing to it.
|
44 |
//
|
45 |
//
|
45 |
// This is active if the sigcleanup parameter to recollinit is set,
|
46 |
// This is active if the sigcleanup parameter to recollinit is set,
|
|
... |
|
... |
307 |
|
308 |
|
308 |
// Make sure the locale charset is initialized (so that multiple
|
309 |
// Make sure the locale charset is initialized (so that multiple
|
309 |
// threads don't try to do it at once).
|
310 |
// threads don't try to do it at once).
|
310 |
config->getDefCharset();
|
311 |
config->getDefCharset();
|
311 |
|
312 |
|
312 |
mainthread_id = pthread_self();
|
313 |
mainthread_id = std::this_thread::get_id();
|
313 |
|
314 |
|
314 |
// Init unac locking
|
|
|
315 |
unac_init_mt();
|
|
|
316 |
// Init smallut and pathut static values
|
315 |
// Init smallut and pathut static values
|
317 |
pathut_init_mt();
|
316 |
pathut_init_mt();
|
318 |
smallut_init_mt();
|
317 |
smallut_init_mt();
|
319 |
rclutil_init_mt();
|
318 |
rclutil_init_mt();
|
320 |
|
319 |
|
|
... |
|
... |
386 |
#endif
|
385 |
#endif
|
387 |
}
|
386 |
}
|
388 |
|
387 |
|
389 |
bool recoll_ismainthread()
|
388 |
bool recoll_ismainthread()
|
390 |
{
|
389 |
{
|
391 |
return pthread_equal(pthread_self(), mainthread_id);
|
390 |
return std::this_thread::get_id() == mainthread_id;
|
392 |
}
|
391 |
}
|
393 |
|
392 |
|