add condtion of pthread and tests

Change-Id: I16a0317486048a042d5962842568953b8903d11e