Phosphorus flame retardants in thermoset resins