#include "PThread_TimeOut.h"

...

status = pthread_create(&hThread,
                               NULL,
          &CTCPComm::ValidateData_Server,
                               &pthread_args);
                               
pthread_join_timeout(hThread, 2000) ;

pthread_detach(hThread);
...

AND