Add multi-threading
Merge pull request #2 from t-mat/cpp-multithread

add multi-threading for c++