Task-based thread processing example