a small example of threaded programming