Added an option to perform a block on a main thread and wait

I was sending a delegate call from a background thread that would update the UI.  If another update came in before the UI was updated the UICollectionView would throw and exception because the count changed on it unexpectedly.   This allows the background thread to wait for the UI to update before moving on.