+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
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. */
{
}
#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);
+}