use pthread_once to initialise the key