While Loop

Almost, as long as you call some sort of API method, the other task will run. In the example, the call to button1.pressing() would allow that.