MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / mi_pthread_key_create

Function mi_pthread_key_create

system/lib/mimalloc/src/init.c:864–879  ·  view source on GitHub ↗

create a non-zero pthread key

Source from the content-addressed store, hash-verified

862
863// create a non-zero pthread key
864static int mi_pthread_key_create( pthread_key_t* pkey ) {
865 pthread_key_t key;
866 int err = pthread_key_create(&key, NULL);
867 if (err!=0) return err;
868 if (key==0) {
869 // if we get a zero key, create another one as we use 0 for an invalid key
870 pthread_key_t key2;
871 err = pthread_key_create(&key2, NULL);
872 pthread_key_delete(key); // delete the old key
873 if (err!=0) return err;
874 key = key2;
875 }
876 mi_assert_internal(key!=0);
877 *pkey = key;
878 return 0;
879}
880
881static void mi_tls_slots_init(void) {
882 mi_atomic_do_once {

Callers 1

mi_tls_slots_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected