common data locking: remove deadlock in mbox cache locking
This commit is contained in:
parent
a4d1689581
commit
c45cdd7561
@ -80,13 +80,13 @@ public:
|
|||||||
~MboxCache() {}
|
~MboxCache() {}
|
||||||
mbhoff_type get_offset(RclConfig *config, const string& udi, int msgnum)
|
mbhoff_type get_offset(RclConfig *config, const string& udi, int msgnum)
|
||||||
{
|
{
|
||||||
PTMutexLocker locker(o_mutex);
|
|
||||||
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
|
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
|
||||||
msgnum));
|
msgnum));
|
||||||
if (!ok(config)) {
|
if (!ok(config)) {
|
||||||
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
|
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
PTMutexLocker locker(o_mutex);
|
||||||
string fn = makefilename(udi);
|
string fn = makefilename(udi);
|
||||||
FILE *fp = 0;
|
FILE *fp = 0;
|
||||||
if ((fp = fopen(fn.c_str(), "r")) == 0) {
|
if ((fp = fopen(fn.c_str(), "r")) == 0) {
|
||||||
@ -128,12 +128,12 @@ public:
|
|||||||
void put_offsets(RclConfig *config, const string& udi, mbhoff_type fsize,
|
void put_offsets(RclConfig *config, const string& udi, mbhoff_type fsize,
|
||||||
vector<mbhoff_type>& offs)
|
vector<mbhoff_type>& offs)
|
||||||
{
|
{
|
||||||
PTMutexLocker locker(o_mutex);
|
|
||||||
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
|
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
|
||||||
if (!ok(config) || !maybemakedir())
|
if (!ok(config) || !maybemakedir())
|
||||||
return;
|
return;
|
||||||
if (fsize < m_minfsize)
|
if (fsize < m_minfsize)
|
||||||
return;
|
return;
|
||||||
|
PTMutexLocker locker(o_mutex);
|
||||||
string fn = makefilename(udi);
|
string fn = makefilename(udi);
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
if ((fp = fopen(fn.c_str(), "w")) == 0) {
|
if ((fp = fopen(fn.c_str(), "w")) == 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user