Check out example codes for "undefined reference to `pthread_create' c++". It will help you in understanding the concepts better.

Code Example 1

add_compile_options(-pthread)

Code Example 2

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

Learn ReactJs, React Native from akashmittal.com