There is a very instructive story about Kamsa in the Srimad Bhagavatam, which is the much-acclaimed purana on the avatar of Sri Krishna. As we all know, it was foretold publicly that Kamsa would be killed by Krishna. What did Kamsa do? Instead of making the best use of the remaining time available to him, he acted in the worst possible manner. He conspired ceaselessly to kill Krishna.
Finally, he sent Akrura to Vraja to fetch the two brothers, Krishna and Balarama. They came and immediately made waves in Mathura, with everybody adoring them. Still, Kamsa wouldn't have a change of heart, though he knew that death was inevitable.
As a consequence, he began to have very fearful dreams. Even during waking hours, he was so possessed of inimical thoughts, that he saw only bad omens. Ultimately, Kamsa was dragged down from his throne and killed by Krishna.
Our lesson from this is that there are well-defined rules for thinking. We all know that loose talk hurts but we don't always realise that unfettered thinking hurts more, as in Kamsa's case.
Angry thoughts make us lose control over ourselves; lustful thoughts degrade us; and greedy thoughts turn us from the right path. No wonder, the Bhagavad Gita warns that these are roads to hell (BG 16.21). Inimical, jealous or hateful thoughts burn us from inside. Fearful thoughts make us depressed, cowardly and sick.
Everyone faces a some problem or the other. But let us find constructive solutions without being oppressed by bad thoughts. We should know that all of us have limits; we could either seek guidance from others or pray to God for inspiration.
Thinking of God also keeps us from being desperate or hopeless. We learn to tolerate the inevitable (BG 2.14), to avoid mental distress.
Thus we develop a positive attitude to life. If the mind must think negatively, which it is prone to do, we need to drag it back (BG 6.26). The choice is ours, whether to make our mind a friend, or suffer foolishly, like Kamsa did.