integrate constraint and multi thread