Sample codes of Threading