reimplemented thread client with locks istead of bussy waiting