dout: use recursive mutex for dout

Using a recursive mutex for dout is desirable because it allows us to
survive situations like this:

> foo() { dout << "foo" << dendl; }
> dout(0) << foo() << dendl;

These cases should be fixed because they produce garbled output.
However, with this change, at least they will not cause deadlock.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-06-01 11:37:34 -07:00
parent 44770df843
commit e340bfe13d

View File

@ -33,7 +33,7 @@ DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss(g_ceph_context
* The dout lock protects calls to dout()
* TODO: needs to become part of CephContext
*/
pthread_mutex_t _dout_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t _dout_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
class CephContextServiceThread : public Thread
{