Add a mutex to protect the per-process fake-getaddrinfo data cache.
authorKen Raeburn <raeburn@mit.edu>
Fri, 23 Jul 2004 15:29:53 +0000 (15:29 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 23 Jul 2004 15:29:53 +0000 (15:29 +0000)
commit20226b353004a566349dae8b1c5a4b1a403b5e72
tree5e6a00672acc8418e4a9a58ede960adc1a2dafea
parent38cd10852cbaec3a4129c5de73bd08e3c1aa0ef3
Add a mutex to protect the per-process fake-getaddrinfo data cache.
Currently it gets locked while a name lookup is in progress, which is not very
efficient.  That should be changed, after the code is fixed up so that the
cache works on other platforms.

* include/fake-addrinfo.h: Include k5-thread.h.
(struct fac): Add a mutex.
(plant_face, find_face): Check that mutex is already locked.
(krb5int_lock_fac, krb5int_unlock_fac): Declare.
(fai_add_hosts_by_name): Use them to lock and unlock the mutex.
* util/support/fake-addrinfo.c (krb5int_fac): Initialize the mutex.
(krb5int_init_fac, krb5int_fini_fac): New functions; finish initializing or
destroy the mutex.
(krb5int_lock_fac, krb5int_unlock_fac): New functions; lock the mutex after
calling krb5int_call_thread_support_init, or unlock it.
* util/support/threads.c (krb5int_call_thread_support_init): New function.
(krb5int_init_fac, krb5int_fini_fac): Declare.
(krb5int_thread_support_init, krb5int_thread_support_fini): Call them.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16622 dc483132-0cff-0310-8789-dd5450dbe970
src/include/ChangeLog
src/include/fake-addrinfo.h
src/util/support/ChangeLog
src/util/support/fake-addrinfo.c
src/util/support/threads.c