Debug pthread problem