termination and creation of threads

I am developing an application in NET+OS 6.3.In this I want to start and stop an application thread (which is calling several other threads) according to a flag set or reset by another thread which is started from applicationStart().
what i have done is just delete all the related threads including the main application thread when the flag set by thread by the other thread and create the thread (which will call the other threads) when the flag reset by the other thread.But it is not working (crashing).what will be the problem?
When we delete a thread after terminating, what will happen to all static & dynamic variables ?


I have attached an example appplication which can be configured to run as either a single- or multi-threaded TCP echo server. As a multi-threaded application it creates and makes use of a garbage collector thread.

The garbage collector is notified when a thread is terminated and cleans up (i.e. calls free()) memory which is no longer necessary (such as the thread stack and thread struct).

There is not enough information in your post from which to better determine what the problem might be. Please contact Digi support directly, if you have not already done so. Before you do this, however, I would encourage you to take the time to examine and work with the attached application.



Do you have to use tx_thread_info_get() to get the state of the thread or can you access this field directly from the thread control block structure.