A New York Times article about boredom reframes it as an opportunity rather than an unavoidable state:

The brain is highly active when disengaged, consuming only about 5 percent less energy in its resting ‚Äúdefault state‚Äù than when involved in routine tasks… That slight reduction can make a big difference in terms of time perception. The seconds usually seem to pass more slowly when the brain is idling than when it is absorbed. And those stretched seconds are not the live-in-the-moment, meditative variety, either. They are frustrated, restless moments. That combination, psychologists argue, makes boredom a state that demands relief—if not from a catnap or a conversation, then from some mental game.

Some evidence for this can be seen in semiconscious behaviors, like doodling during a dull class, braiding strands of hair, folding notebook paper into odd shapes. Daydreaming too can be a kind of constructive self-entertainment, psychologists say, especially if the mind is turning over a problem. In experiments in the 1970s, psychiatrists showed that participants completing word-association tasks quickly tired of the job once obvious answers were given; granted more time, they began trying much more creative solutions, as if the boredom ‚Äúhad the power to exert pressure on individuals to stretch their inventive capacity.”