Initialize TSD key earlier in the startup process. Newer Linux/Linux distributions...
[citadel.git] / citadel / sysdep.c
index 971d729c4c282de588a791b04dd7de96eddbd679..c547f9772be4cff4c5fee27c84291bfb8d93817a 100644 (file)
@@ -86,14 +86,14 @@ void init_sysdep(void) {
        init_ssl();
 #endif
 
-       /*
-        * Set up a place to put thread-specific data.
-        * We only need a single pointer per thread - it points to the
-        * CitContext structure (in the ContextList linked list) of the
-        * session to which the calling thread is currently bound.
-        */
-       if (pthread_key_create(&MyConKey, NULL) != 0) {
+       if (pthread_key_create(&ThreadKey, NULL) != 0) {                        // TSD for threads
+               syslog(LOG_ERR, "pthread_key_create() : %m");
+               abort();
+       }
+       
+       if (pthread_key_create(&MyConKey, NULL) != 0) {                         // TSD for sessions
                syslog(LOG_CRIT, "sysdep: can't create TSD key: %m");
+               abort();
        }
 
        /*