> For the complete documentation index, see [llms.txt](https://dimitar-minchev.gitbook.io/linux-system-programming/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dimitar-minchev.gitbook.io/linux-system-programming/08_threads/08_thread_cancellations.md).

# Функции за прекратяване на нишки

```c
int pthread_cancel(pthread_t thread);
```

изпраща заявка за прекратяване на нишка **thread**.

```c
int pthread_setcancelstate(int state, int *oldstate);
```

задава състояние за прекратяване на нишката посредством **state** на **PTHREAD\_CANCEL\_ENABLE** или **PTHREAD\_CANCEL\_DISABLE**

```c
int pthread_setcanceltype(int type, int *oldtype);
```

задава тип за прекратяване на нишката посредством **type** на **PTHREAD\_CANCEL\_DEFERRED** или **PTHREAD\_CANCEL\_ASYNCHRONOUS**
