/* Create a key for thread-specific data. 
See IEEE 1003.1  */
int pthread_key_create(pthread_key_t *key, void(*destructor)(void *))
/* Create a key for thread-specific data. 
See IEEE 1003.1  */
int pthread_key_create(pthread_key_t *key, void(*destructor)(void *))
{
	pthread_key_obj *new_key;
	*key = PTHREAD_KEY_INITIALIZER;
	new_key = to_posix_key(key);
	if (new_key == NULL) {
		return ENOMEM;
	}
	sys_slist_init(&(new_key->key_data_l));
	new_key->destructor = destructor;
	LOG_DBG("Initialized key %p (%x)", new_key, *key);
	return 0;
}