add primitive support for multithreading