threading_counter decrease moved to end of thread function