One of the simplest ways would be to use two threads like CatShoe has already mentioned. Also refer to this FAQ item, very informative.