Fix scheduler_id race condition with nif thread specific data