Changeset: 4048cc09742d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4048cc09742d
Modified Files:
tools/merovingian/daemon/merovingian.c
Branch: Apr2011
Log Message:
mero logging: only stop logging when all buffers have been emptied
Due to race conditions, it could happen that last parts (in particular
the "Merovingian X.Y stoppped") of the logoutput wouldn't be written,
because the logger was terminated before all available content was
written.
Now only return when select indicated nothing is available for writing
to the log. This should be safe, since all producers have been stopped
already at the point we start waiting for the logthread to end.
diffs (28 lines):
diff --git a/tools/merovingian/daemon/merovingian.c
b/tools/merovingian/daemon/merovingian.c
--- a/tools/merovingian/daemon/merovingian.c
+++ b/tools/merovingian/daemon/merovingian.c
@@ -216,8 +216,13 @@
pthread_mutex_unlock(&_mero_topdp_lock);
- if (select(nfds + 1, &readfds, NULL, NULL, &tv) <= 0)
- continue;
+ if (select(nfds + 1, &readfds, NULL, NULL, &tv) <= 0) {
+ if (_mero_keep_logging != 0) {
+ continue;
+ } else {
+ break;
+ }
+ }
pthread_mutex_lock(&_mero_topdp_lock);
@@ -235,7 +240,7 @@
pthread_mutex_unlock(&_mero_topdp_lock);
fflush(_mero_logfile);
- } while (_mero_keep_logging != 0);
+ } while (1);
}
/**
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list