Jerritt,
Probably fuel starvation caused by one of several possibilities:
1. Blocked fuel cap vent.
2, Blocked fuel delivery hose from the petcock to the carbs.
3. Blocked fuel filter.
4. Low fuel in the tank.
The bike runs fine for 40 miles but then the carbs are starved by one of the conditions listed. You stop and wait a few minutes. The fuel slowly trickles into the carb bowls. The bike starts up just fine and runs until the carbs are empty again.
Of course, we remember the expression "if you think your have carb problems, check the ignition" and in this case it could be a bad coil that quits when it gets hot and comes back to life when it cools down, except you have a '79 with two coils, so only one of the coils and one cylinder would fail, not both at the same time, unless you have an aftermarket ignition that only uses one coil.