Can somebody provide me example of starting and stop an userdefined timer on PTHREAD concepts ? Basically, like this. one thread started TIMER1, now other thread on TIMER1 with value x need to stop the TIMER1 and start TIMER2. Please help me. for ex: In the following program, can somebody suggest me to start another THREAD and cancel the the timer which i started currently when it is delayed for 3secs. Code: struct timeval tv; int set_timer(struct timeval &tv,time_t sec) { gettimeofdat(&tv,NULL); tv.tv_sec += sec; return 1; } void* timer(void* arg) { set_timer(tv,5); } int main(int argc, char* argv[]) { pthread_create (&thread_id, NULL,&timer,NULL); pthread_join(&thread_id); }