[api] fix thread dead locks for real