Initialize logmtx and watcher_cond before the first log rewrite

I had missed to move these when I changed the locking scheme
of rewrites before the public release, and I find it curious
that my test systems did not complain.

Anyway, fixes #1
parent 1d144358
......@@ -5482,6 +5482,12 @@ fellow_logwatcher_init(struct fellow_fd *ffd)
AZ(pthread_condattr_init(&ca));
AZ(pthread_condattr_setclock(&ca, CLOCK_MONOTONIC));
AZ(pthread_cond_init(&ffd->watcher_cond, &ca));
}
// not unter logmtx
static void
fellow_logwatcher_start(struct fellow_fd *ffd)
{
ffd->watcher_running = 1;
AZ(pthread_create(&ffd->watcher_thread, NULL,
fellow_logwatcher_thread, ffd));
......@@ -5859,6 +5865,9 @@ fellow_log_open(struct fellow_fd *ffd,
struct fellow_log_memfail mf[1];
pthread_t mf_thread;
AZ(pthread_mutex_init(&ffd->logmtx, NULL));
fellow_logwatcher_init(ffd);
INIT_OBJ(mf, FELLOW_LOG_MEMFAIL_MAGIC);
mf->membuddy = ffd->membuddy;
mf->phase = 1;
......@@ -5875,8 +5884,7 @@ fellow_log_open(struct fellow_fd *ffd,
}
AZ(pthread_join(mf_thread, NULL));
AZ(pthread_mutex_init(&ffd->logmtx, NULL));
fellow_logwatcher_init(ffd);
fellow_logwatcher_start(ffd);
}
void
......
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