This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Resource free after use

Hi All,

I have a doubt regarding resources freeing in Keil RTX.

There is no API in Keil RTX to destroy the MailQueue, created using osMailCreate() or MessageQueue created using osMessageCreate(). How shall we ensure the resource are freed after use?

The issue we are facing is, we are not able to create again the MailQueue or MessageQueue once created.

Consider an application containing 2 function -initialization function and termination function. In Initialization function, thread and it associated resource are created. In the termination function, we freed the allocated memory, made the Queue ID as NULL and terminated the thread .

Initialization is called on startup and termination on an event in run time. Initialization is called again (after termination) on run time on receiving an event. On second time the initialization fails because we are not able to create the MailQueue or MessageQueue.

Is there any method to free the resource after use? How can i overcome this issue?

Thanks for your support.

Regards
Priya

Parents
  • A traditional program reates/destroys mails while running. But only once creates a mail queue. Then keeps that meil queue until power is lost.

    In a real world, you don't dismantle the local postal office just because you don't have any mail to send today and then rebuild it when you need to send something.

    So you would normally create your mail queue outside of any threads. Then you can add producer and/or consumer threads making use of the queue, just as the postal office can hire additional staff depending on the work burden.

Reply
  • A traditional program reates/destroys mails while running. But only once creates a mail queue. Then keeps that meil queue until power is lost.

    In a real world, you don't dismantle the local postal office just because you don't have any mail to send today and then rebuild it when you need to send something.

    So you would normally create your mail queue outside of any threads. Then you can add producer and/or consumer threads making use of the queue, just as the postal office can hire additional staff depending on the work burden.

Children
No data