# Delete task that holds Mutex

**URL:** <https://forums.freertos.org/t/delete-task-that-holds-mutex/6234>\
**Category:** Kernel\
**Created:** [November 2, 2016, 1:55pm UTC](https://forums.freertos.org/t/delete-task-that-holds-mutex/6234 "2016-11-02T13:55:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 2, 2016, 1:55pm UTC](https://forums.freertos.org/t/delete-task-that-holds-mutex/6234/1 "2016-11-02T13:55:15Z")

</div>

**[sheinz](https://sourceforge.net/u/sheinz/)** wrote on [Wednesday, November 02, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/e959f067/#eeaa):

Hello,

We are experiencing a system crash when a task that creates and holds a Mutex is deleted.  
To be precise the crash happens when another task tries to take the mutex.

I understand that it is not correct usage of Mutexes but is it expected that system crashes in this case?  
I mean will deleting a task that holds a Mutex leave this mutex in some undefined state?

Thanks.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [November 2, 2016, 2:25pm UTC](https://forums.freertos.org/t/delete-task-that-holds-mutex/6234/2 "2016-11-02T14:25:24Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, November 02, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/e959f067/#eeaa/4d6a):

Do not delete a task that holds a mutex. Have the mutex released first,  
then delete the task.
