Commit 0bd618ec authored by Nils Goroll's avatar Nils Goroll

avoid taking reopen_lock for every write

parent bd71d41f
......@@ -185,10 +185,14 @@ wrt_write(tx_t *tx)
CHECK_OBJ_NOTNULL(tx, TX_MAGIC);
assert(tx->state == TX_SUBMITTED);
AZ(pthread_mutex_lock(&reopen_lock));
if (reopen && fo != stdout) {
while (reopen && fo != stdout) {
int errnum;
AZ(pthread_mutex_lock(&reopen_lock));
if (! reopen) {
AZ(pthread_mutex_unlock(&reopen_lock));
break;
}
wrt_return_freelist();
if (fflush(fo) != 0)
LOG_Log(LOG_ERR, "Cannot flush to %s, DATA DISCARDED: %s",
......@@ -204,8 +208,9 @@ wrt_write(tx_t *tx)
exit(EXIT_FAILURE);
}
reopen = 0;
AZ(pthread_mutex_unlock(&reopen_lock));
break;
}
AZ(pthread_mutex_unlock(&reopen_lock));
VRMB();
os = FMT_Format(tx, &len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment