diff options
Diffstat (limited to 'private.c')
-rw-r--r-- | private.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -391,8 +391,7 @@ ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP, * Have to create an association and add it * to both the key and the thread. */ - assoc = (ThreadKeyAssoc *) - calloc (1, sizeof (*assoc)); + assoc = (ThreadKeyAssoc *) calloc (1, sizeof (*assoc)); if (assoc == NULL) { @@ -400,11 +399,22 @@ ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP, goto FAIL0; } +#if 0 + if ((result = pthread_mutex_init (&(assoc->lock), NULL)) != 0) { goto FAIL1; } +#else + + /* + * Initialise only when used for the first time. + */ + assoc->lock = PTHREAD_MUTEX_INITIALIZER; + +#endif + assoc->thread = thread; assoc->key = key; |