Turn Multi-core Optimization Off

How can I turn the multi-core optimization off and let the built-in OpenCV functions just to run on single core? Or how can I set number of cores to use in built-in OpenCV functions?

you can restrict the number of threads used at runtime