40 amp is too big a breaker for that compressor unless its a 7.5hp single phase (which i doubt as they are rare and expensive in all the research i did). Drop it to a 30 and do like mike said, figure out what amp rating is. if your too big of a breaker, should something happen and it short out, the breaker could NOT trip and then you have a fire on your hands.
i have 200a service to my house. right now i have the A/C, range, dryer, air compressor, 2 220 plugs in the garage for welder/plasma, and 220 out let for my trailer to plug into on breakers. all those combined are well over my 200a limit if you base it off breaker rating and thats not including the 110 breakers. I also have a load controller on the house from 1989, but dont even know if it works lol. if it does, i have it hooked to the compressor as well as the range and dryer. should the a/c be on, compressor kick on and the wife have the dryer running while cooking dinner and the load is greater than 100 amps, it will kick the compressor off first. If the load is still high, it will kick the dryer next, and so on. it seems counter intuitive to cut something out when i still have 100amps left but i dont want to have a spike from my welder or kicking the a/c on in the trailer to kill my main power and have everything die on me. i need to get my brother in-law over to the house to make sure the load controller works though lol