Thread safe code bug

'slot' should be assigned before comparison.
Otherwise, scope->next_slot may be changed between the assignment expression and the compare expression. That may lead to overflow of slot_names.