Multithreading mechanism