* threads.c (krb5int_mutex_alloc, krb5int_mutex_free, krb5int_mutex_lock,
authorKen Raeburn <raeburn@mit.edu>
Wed, 25 Jan 2006 06:21:47 +0000 (06:21 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 25 Jan 2006 06:21:47 +0000 (06:21 +0000)
krb5int_mutex_unlock): New functions.
(krb5int_mutex_lock_update_stats, krb5int_mutex_unlock_update_stats,
krb5int_mutex_report_stats): Always define, even if not doing anything.
* libkrb5support.exports: Export the new functions.

ticket: 3417
status: open

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17607 dc483132-0cff-0310-8789-dd5450dbe970

src/util/support/ChangeLog
src/util/support/libkrb5support.exports
src/util/support/threads.c

index 8aa8414c34377b992401fcf69a8c148bc935a258..d40ec99cd2f3c4b48ad11b0c53785554c53d6240 100644 (file)
@@ -1,3 +1,12 @@
+2006-01-25  Ken Raeburn  <raeburn@mit.edu>
+
+       * threads.c (krb5int_mutex_alloc, krb5int_mutex_free,
+       krb5int_mutex_lock, krb5int_mutex_unlock): New functions.
+       (krb5int_mutex_lock_update_stats,
+       krb5int_mutex_unlock_update_stats, krb5int_mutex_report_stats):
+       Always define, even if not doing anything.
+       * libkrb5support.exports: Export the new functions.
+
 2005-09-09  Ken Raeburn  <raeburn@mit.edu>
 
        * fake_addrinfo.c (getaddrinfo): Conditionalize last change on
index 9607ef8226b094b3ecf03df0ed096ebf46c77afd..d06911d5333627cc49ae57e41e6eab2db8560669 100644 (file)
@@ -11,3 +11,7 @@ krb5int_gai_strerror
 krb5int_getnameinfo
 krb5int_in6addr_any
 krb5int_pthread_loaded
+krb5int_mutex_alloc
+krb5int_mutex_free
+krb5int_mutex_lock
+krb5int_mutex_unlock
index 8a00e4c2bd7feabdf17b557a931862f24363a01f..d3b5c1bef3b28b92d4ddbb998901490b3d6f3a48 100644 (file)
@@ -585,7 +585,7 @@ krb5int_mutex_report_stats(k5_mutex_t *m)
            sd_hold);
   }
 }
-#elif defined _WIN32
+#else
 /* On Windows, everything defined in the export list must be defined.
    The UNIX systems where we're using the export list don't seem to
    care.  */
@@ -606,3 +606,42 @@ krb5int_mutex_report_stats(k5_mutex_t *m)
 {
 }
 #endif
+
+/* Mutex allocation functions, for use in plugins that may not know
+   what options a given set of libraries was compiled with.  */
+int KRB5_CALLCONV
+krb5int_mutex_alloc (k5_mutex_t **m)
+{
+    k5_mutex_t *ptr;
+    int err;
+
+    ptr = malloc (sizeof (k5_mutex_t));
+    if (ptr == NULL)
+       return errno;
+    err = k5_mutex_init (ptr);
+    if (err) {
+       free (ptr);
+       return err;
+    }
+    *m = ptr;
+    return 0;
+}
+
+void KRB5_CALLCONV
+krb5int_mutex_free (k5_mutex_t *m)
+{
+    (void) k5_mutex_destroy (m);
+    free (m);
+}
+
+/* Callable versions of the various macros.  */
+int KRB5_CALLCONV
+krb5int_mutex_lock (k5_mutex_t *m)
+{
+    return k5_mutex_lock (m);
+}
+int KRB5_CALLCONV
+krb5int_mutex_unlock (k5_mutex_t *m)
+{
+    return k5_mutex_unlock (m);
+}