GCD catalog scanning & writing

This is a first pass at making the Catalog use GCD instead of threads, in order to finally get rid of the various threading problems when writing.

Please note it's *highly* experimental (I think the task didn't like that for example), and I'm not sure I got it right.