optimizing processor_thread_handler