I am **beginner** to C programming I created a new thread and its working fine ,my thread blocks the code at **accept**.Does calling **pthread\_cancel** from outside terminates the thread.Or do I need to **close the socket** from outside.

Inside thread code it is a blocking code 

```
 while( (clientfd = accept(socketfd, (struct sockaddr *)&client,&clilen)) )
        {
                printf("New Client connected");
                ......
        }

```

Calling **pthread\_cancel** from outside

```
pthread_cancel(thread_id);

```

What happens?