Add error checking for pthread_setspecific() and pthread_key_create().