# Checking for and deleting task handle

**URL:** <https://forums.freertos.org/t/checking-for-and-deleting-task-handle/5430>\
**Category:** Kernel\
**Created:** [April 25, 2013, 11:28pm UTC](https://forums.freertos.org/t/checking-for-and-deleting-task-handle/5430 "2013-04-25T23:28:12Z")\
**Posts on this page:** 4\
**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:** [April 25, 2013, 11:28pm UTC](https://forums.freertos.org/t/checking-for-and-deleting-task-handle/5430/1 "2013-04-25T23:28:12Z")

</div>

**[groufosse](https://sourceforge.net/u/groufosse/)** wrote on [Thursday, April 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/f04140c3/#a9a2):

Hi,

I have a very simple question. How can I check to see if a task (using it’s task handle) is still in existence, or if it has been deleted?&nbsp; If I delete it using vTaskDelete, then check the handle to see if it’s NULL, doesn’t seem to work.

Should vTaskDelete, after it’s completed, NULL the xTaskHandle pointer?

Thanks for your help!

---

<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:** [April 25, 2013, 11:57pm UTC](https://forums.freertos.org/t/checking-for-and-deleting-task-handle/5430/2 "2013-04-25T23:57:10Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, April 25, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/f04140c3/#4af0):

The vTaskDelete function can’t do it as the parameter is not passed in by reference, but the task that calls the delete function can null the handle if that’s what is required.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [April 26, 2013, 12:12am UTC](https://forums.freertos.org/t/checking-for-and-deleting-task-handle/5430/3 "2013-04-26T00:12:27Z")

</div>

**[groufosse](https://sourceforge.net/u/groufosse/)** wrote on [Friday, April 26, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/f04140c3/#4373):

Hi,  
Thank you for the prompt reply.  
Sorry to ask…just how do I get the function it to NULL the pointer. I can’t assign anything on the return function…

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [April 26, 2013, 12:14am UTC](https://forums.freertos.org/t/checking-for-and-deleting-task-handle/5430/4 "2013-04-26T00:14:49Z")

</div>

**[groufosse](https://sourceforge.net/u/groufosse/)** wrote on [Friday, April 26, 2013](https://sourceforge.net/p/freertos/discussion/382005/thread/f04140c3/#a532):

OK, I now see what you are saying. Thanks!
