Finished multi-threading code in Device.