pthread_key_create() returns zero after completing successfully. Any other return value indicates that an error occurred. When any of the following conditions occur, pthread_key_create() fails and returns the corresponding value.
EAGAIN
Description:The key name space is exhausted.
ENOMEM
Description:Insufficient virtual memory is available in this process to create a new key.