pass thread idx to init functions