Check thread safety of tasks

Just got an exception because main thread added a task while `refreshAllTasks:` was running (followed by Foundation NSException handler calling `pthread_kill` against one of GCD's global queues. Ouch. Hopefully I'm running DEBUG ;-)).