|
a/src/common/rclinit.h |
|
b/src/common/rclinit.h |
|
... |
|
... |
16 |
*/
|
16 |
*/
|
17 |
#ifndef _RCLINIT_H_INCLUDED_
|
17 |
#ifndef _RCLINIT_H_INCLUDED_
|
18 |
#define _RCLINIT_H_INCLUDED_
|
18 |
#define _RCLINIT_H_INCLUDED_
|
19 |
|
19 |
|
20 |
#include <string>
|
20 |
#include <string>
|
21 |
#ifndef NO_NAMESPACES
|
|
|
22 |
using std::string;
|
|
|
23 |
#endif
|
|
|
24 |
|
21 |
|
25 |
class RclConfig;
|
22 |
class RclConfig;
|
26 |
/**
|
23 |
/**
|
27 |
* Initialize by reading configuration, opening log file, etc.
|
24 |
* Initialize by reading configuration, opening log file, etc.
|
28 |
*
|
25 |
*
|
29 |
* This must be called from the main thread before starting any others. It sets
|
26 |
* This must be called from the main thread before starting any others. It sets
|
30 |
* up the global signal handling. other threads must call recoll_threadinit()
|
27 |
* up the global signal handling. other threads must call recoll_threadinit()
|
31 |
* when starting.
|
28 |
* when starting.
|
32 |
*
|
29 |
*
|
33 |
* @param flags misc modifiers. These are currently only used to customize
|
30 |
* @param flags misc modifiers. These are currently only used to customize
|
34 |
* the log file and verbosity.
|
31 |
* the log file and verbosity.
|
35 |
* @param cleanup function to call before exiting (atexit)
|
32 |
* @param cleanup function to call before exiting (atexit)
|
36 |
* @param sigcleanup function to call on terminal signal (INT/HUP...) This
|
33 |
* @param sigcleanup function to call on terminal signal (INT/HUP...) This
|
37 |
* should typically set a flag which tells the program (recoll,
|
34 |
* should typically set a flag which tells the program (recoll,
|
38 |
* recollindex etc.. to exit as soon as possible (after closing the db,
|
35 |
* recollindex etc.. to exit as soon as possible (after closing the db,
|
39 |
* etc.). cleanup will then be called by exit().
|
36 |
* etc.). cleanup will then be called by exit().
|
40 |
* @param reason in case of error: output string explaining things
|
37 |
* @param reason in case of error: output string explaining things
|
41 |
* @param argcnf Configuration directory name from the command line (overriding
|
38 |
* @param argcnf Configuration directory name from the command line (overriding
|
42 |
* default and environment
|
39 |
* default and environment
|
43 |
* @return the parsed configuration.
|
40 |
* @return the parsed configuration.
|
44 |
*/
|
41 |
*/
|
45 |
enum RclInitFlags {RCLINIT_NONE=0, RCLINIT_DAEMON=1, RCLINIT_IDX=2};
|
42 |
enum RclInitFlags {RCLINIT_NONE = 0, RCLINIT_DAEMON = 1, RCLINIT_IDX = 2};
|
46 |
extern RclConfig *recollinit(RclInitFlags flags,
|
43 |
extern RclConfig *recollinit(RclInitFlags flags,
|
47 |
void (*cleanup)(void), void (*sigcleanup)(int),
|
44 |
void (*cleanup)(void), void (*sigcleanup)(int),
|
48 |
string &reason, const string *argcnf = 0);
|
45 |
std::string& reason, const string *argcnf = 0);
|
49 |
inline RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
46 |
inline RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
50 |
string &reason, const string *argcnf = 0) {
|
47 |
std::string& reason,
|
|
|
48 |
const std::string *argcnf = 0)
|
|
|
49 |
{
|
51 |
return recollinit(RCLINIT_NONE, cleanup, sigcleanup, reason, argcnf);
|
50 |
return recollinit(RCLINIT_NONE, cleanup, sigcleanup, reason, argcnf);
|
52 |
}
|
51 |
}
|
53 |
|
52 |
|
54 |
// Threads need to call this to block signals.
|
53 |
// Threads need to call this to block signals.
|
55 |
// The main thread handles all signals.
|
54 |
// The main thread handles all signals.
|
56 |
extern void recoll_threadinit();
|
55 |
extern void recoll_threadinit();
|
57 |
|
56 |
|
58 |
// Check if main thread
|
57 |
// Check if main thread
|
59 |
extern bool recoll_ismainthread();
|
58 |
extern bool recoll_ismainthread();
|