Use DoutLocker rather than Mutex::Locker, in preparation for making the
dout_lock a plain old pthread_mutex_t.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
int dout_handle_daemonize()
{
- Mutex::Locker l(_dout_lock);
+ DoutLocker _dout_locker;
if (_dout_need_open)
_dout_open_log(true);
int dout_create_rank_symlink(int n)
{
- Mutex::Locker l(_dout_lock);
+ DoutLocker _dout_locker;
if (_dout_need_open)
_dout_open_log(true);
extern int dout_create_rank_symlink(int n);
+class DoutLocker
+{
+public:
+ DoutLocker() {
+ _dout_lock.Lock();
+ }
+ ~DoutLocker() {
+ _dout_lock.Unlock();
+ }
+};
+
static inline void _dout_begin_line(signed int prio) {
if (unlikely(_dout_need_open))
_dout_open_log(true);
if (0) {\
char __array[((v >= -1) && (v <= 200)) ? 0 : -1] __attribute__((unused)); \
}\
- Mutex::Locker _dout_locker(_dout_lock);\
+ DoutLocker __dout_locker; \
_dout_begin_line(v); \
#define dout(v) \
// In the long term, it would be best to ensure that we read ceph.conf
// before initializing dout(). For now, just force a reopen here with the
// configuration we have just read.
- Mutex::Locker l(_dout_lock);
+ DoutLocker _dout_locker;
_dout_open_log(false);
}
DoutStreambuf<char> *dos = new DoutStreambuf<char>();
- _dout_lock.Lock();
- dos->read_global_config();
- _dout_lock.Unlock();
+ {
+ DoutLocker _dout_locker;
+ dos->read_global_config();
+ }
derr << "using configuration: " << dos->config_to_str() << dendl;
std::ostream oss(dos);