posix: add pthread wrapper

Use reaper thread to free dynamically allocated stacks
added pthread test case