+
+/* Start a perpetually-running thread that flushes the cache occasionally. */
+static gpointer flushd_thread(BlueSkyFS *fs)
+{
+ while (TRUE) {
+ bluesky_flushd_invoke(fs);
+ struct timespec delay;
+ delay.tv_sec = 2;
+ delay.tv_nsec = 0;
+ nanosleep(&delay, NULL);
+ }
+
+ return NULL;
+}
+
+void bluesky_flushd_thread_launch(BlueSkyFS *fs)
+{
+ g_thread_create((GThreadFunc)flushd_thread, fs, FALSE, NULL);
+}