[Solved] does returning from a thread release the resources? [closed]


the problem is that when i put a new task in the queue the thread does not begin to pop from the queue

Because it is terminated. If the thread is terminated when you push items, you must create a new one. Terminated means “done, from the OS point of view”. It will not restart. Happens when you let the function in the thread “run out” – the return from the jump in method will terminate the thread.

Generally, I Would not work with threads here – I would work with tasks and queue a task whenever I push an item into the queue and there is no task already scheduled. A little “HasTask” bool with some locking and you are set.

What happens is that you have a programming error, show no code and do not think about edge cases in your logic. So the thread pulling items ends, you push something into the queue and – well…. I suggest you open a new question that has (a) a relevant title and (b) shows more work on your end to do debugging, in the form of enough code samples to walk you through the problem. This answer here is as good as you can get with the question you asked.

2

solved does returning from a thread release the resources? [closed]