Switch to unified view

a/src/index/indexer.h b/src/index/indexer.h
...
...
20
20
21
#include <string>
21
#include <string>
22
#include <list>
22
#include <list>
23
#include <map>
23
#include <map>
24
#include <vector>
24
#include <vector>
25
#include <mutex>
25
26
26
using std::string;
27
using std::string;
27
using std::list;
28
using std::list;
28
using std::map;
29
using std::map;
29
using std::vector;
30
using std::vector;
30
31
31
#include "rcldb.h"
32
#include "rcldb.h"
32
#include "rcldoc.h"
33
#include "rcldoc.h"
33
#ifdef IDX_THREADS
34
#include "ptmutex.h"
35
#endif
36
34
37
class FsIndexer;
35
class FsIndexer;
38
class BeagleQueueIndexer;
36
class BeagleQueueIndexer;
39
37
40
class DbIxStatus {
38
class DbIxStatus {
...
...
64
/** Callback to say what we're doing. If the update func returns false, we
62
/** Callback to say what we're doing. If the update func returns false, we
65
 * stop as soon as possible without corrupting state */
63
 * stop as soon as possible without corrupting state */
66
class DbIxStatusUpdater {
64
class DbIxStatusUpdater {
67
 public:
65
 public:
68
#ifdef IDX_THREADS
66
#ifdef IDX_THREADS
69
    PTMutexInit m_mutex;
67
    std::mutex m_mutex;
70
#endif
68
#endif
71
    DbIxStatus status;
69
    DbIxStatus status;
72
    virtual ~DbIxStatusUpdater(){}
70
    virtual ~DbIxStatusUpdater(){}
73
71
74
    // Convenience: change phase/fn and update
72
    // Convenience: change phase/fn and update
75
    virtual bool update(DbIxStatus::Phase phase, const string& fn)
73
    virtual bool update(DbIxStatus::Phase phase, const string& fn)
76
    {
74
    {
77
#ifdef IDX_THREADS
75
#ifdef IDX_THREADS
78
  PTMutexLocker lock(m_mutex);
76
  std::unique_lock<std::mutex>  lock(m_mutex);
79
#endif
77
#endif
80
        status.phase = phase;
78
        status.phase = phase;
81
        status.fn = fn;
79
        status.fn = fn;
82
        return update();
80
        return update();
83
    }
81
    }