simultaneous execution of two threads using polling