Commit graph

120 commits

Author SHA1 Message Date
Joey Hess
4888c5b042 improve thread termination handling
The reason the DirWatcher had to wait for program termination was because
it used withINotify, so when it finished, its watcher threads were killed.
But since I have two DirWatcher threads now, that was not good, and could
perhaps explain the MVar problem I saw yesterday. In any case, fixed this
part of the code by making the DirWatcher return a handle that can be used
to stop it, and now the main Assistant thread is the only one calling
waitForTermination.
2012-06-28 13:37:03 -04:00
Joey Hess
40f357fdcf tweak 2012-06-28 13:04:02 -04:00
Joey Hess
67c8ef7de2 use a TMVar
SampleMVar won't work; between getting the current value and changing
it, another thread could made a change, which would get lost.

TMVar works well; this update situation is handled by atomic transactions.
2012-06-26 19:21:44 -04:00
Joey Hess
5cfe91f06d add a push retry thread 2012-06-25 16:38:12 -04:00
Joey Hess
0b146f9ecc reorg threads 2012-06-25 16:10:24 -04:00
Joey Hess
e699ce1841 added a merger thread
Wow! I can create a file in repo a, and it instantly* shows up in repo b!

* under 1 second anyway
2012-06-22 17:01:08 -04:00
Joey Hess
28e28bc043 stub syncer thread and commit channel 2012-06-22 14:10:25 -04:00
Joey Hess
3ee44cf8fe add assistant command
like watch, but more magic
2012-06-22 13:04:03 -04:00
Joey Hess
33b914bcf1 pending adds now retried for kqueue
Rethought how to keep track of pending adds that need to be retried later.
The commit thread already run up every second when there are changes,
so let's keep pending adds queued as changes until they're safe to add.

Also, the committer is now smarter about avoiding empty commits when
all the adds are currently unsafe, or in the rare case that an add event
for a symlink is not received in time. It may avoid them entirely.

This seems to work as before for inotify, and is untested for kqueue.

(Actually commit batching seems to be improved for inotify, although I'm
not sure why. I'm seeing only two commits made during large batch
operations, and the first of those is the non-batch mode commit.)
2012-06-20 19:29:53 -04:00
Joey Hess
e0fdfb2e70 maintain set of files pendingAdd
Kqueue needs to remember which files failed to be added due to being open,
and retry them. This commit gets the data in place for such a retry thread.

Broke KeySource out into its own file, and added Eq and Ord instances
so it can be stored in a Set.
2012-06-20 16:31:46 -04:00
Joey Hess
57cf65eb6d fix kevent symlink creation 2012-06-19 02:40:21 -04:00
Joey Hess
c373f6e954 note 2012-06-17 14:25:02 -04:00
Joey Hess
1863185693 startup check fixes
Move lsof check, and display a message before daemon startup if on an
unsupported OS.
2012-06-17 14:21:29 -04:00
Joey Hess
7d6329e5e4 check lsof at runtime 2012-06-16 02:49:26 -04:00
Joey Hess
0052cec2b7 add lsof build deps
Check for it in configure; and add a --force option for people without it
who want to live dangerously.
2012-06-15 23:29:39 -04:00
Joey Hess
89dad12b35 update 2012-06-13 19:32:09 -04:00
Joey Hess
8919c2e4da check for unstaged old symlinks in the sanity checker 2012-06-13 19:25:47 -04:00
Joey Hess
4b9b9b4947 add sanity checker thread
Currently wakes up once a day, and does nothing. :)
2012-06-13 17:54:23 -04:00
Joey Hess
59a7b3a51a finish daemon status thread 2012-06-13 14:02:40 -04:00
Joey Hess
ccc5005245 reorganize 2012-06-13 12:46:39 -04:00