I am using MGTwitterEngine to fetch tweets from twitter. This uses a asynchrounous paradigm to fetch that tweetsin another thread. It returns the fetched results to the main thread.
Because I have some processing todo after the tweets are fetched, I would like to introduce another thread to prevent locking the UI thread. I would lik to do it this way: UI thread starts a new thread X. thread X starts the asynchronous fetching of tweets with MGTEngine, and waits for that to finish. When MGTwitterEngine returns, thread X processes the tweets, and notifies the UI thread that we are ready.
My question is: How to set thread X to wait till MGTwitterEngine is reade?
There is very little excuses not to use multithreading with blocks now. They are quicker to develop than NSOperations, synchronisation is simpler, jumping threads (e.g. grabbing the UI thread) is simpler and in my own experience it performance is better.
In this case, I would create a block, spawn a new thread to fire up your async fetch (possibly spawning an async fetch for each one- makes cancelations easier) put 2 sync blocks in the queue that will fire after the fetches are done for the processing and the UI update. Here is a good tut: http://www.fieryrobot.com/blog/2010/06/27/a-simple-job-queue-with-grand-central-dispatch/