Moved thread_ids to stack vars in main() from global scope