CAROLINE-28: Multithreading.

CAROLINE-28: Add pthread multithreading implementation.

CAROLINE-28: Fix build.