Custom Thread in C++