pthread sample improvments