Setup Thread
Setup double buffer