summaryrefslogtreecommitdiffstats
path: root/src/include/k5-thread.h
Commit message (Collapse)AuthorAgeFilesLines
* Assume mutex locking cannot failGreg Hudson2013-05-141-14/+10
| | | | | | | | | | | | Locking and unlocking a non-recursive mutex is a simple memory operation and should not fail on any reasonable platform with correct usage. A pthread mutex can return EDEADLK on lock or EPERM on unlock, or EINVAL if the mutex is uninitialized, but all of these conditions would reflect serious bugs in the calling code. Change the k5_mutex_lock and k5_mutex_unlock wrappers to return void and adjust all call sites. Propagate this change through k5_cc_mutex_lock and k5_cc_mutex_unlock as well.
* Remove orphaned KfM codeGreg Hudson2012-06-211-2/+0
|
* Adjust most C source files to match the new standards for copyrightGreg Hudson2011-03-091-5/+1
| | | | | | and license comments. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24695 dc483132-0cff-0310-8789-dd5450dbe970
* Reindent include directory, reformatting prototypes as necessary.Greg Hudson2009-11-141-163/+164
| | | | | | | Exclude include/gssrpc due to its Sun origin and k5-platform.h due to macros too hairy for emacs c-mode to handle. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23180 dc483132-0cff-0310-8789-dd5450dbe970
* make mark-cstyleTom Yu2009-10-311-2/+2
| | | | | | make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
* Merge KerberosIPC into k5_mig supportAlexandra Ellwood2008-10-151-6/+1
| | | | | | | | | Now that there are no servers using only kipc_* calls, merge them into the k5_mig_* calls. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20873 dc483132-0cff-0310-8789-dd5450dbe970
* Removed useless init and cleanup functions. Alexandra Ellwood2008-09-291-1/+1
| | | | | | | | Fixed request port list handling. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20778 dc483132-0cff-0310-8789-dd5450dbe970
* Create common stream and ipc layer for CCAPI and KIM. Alexandra Ellwood2008-09-281-0/+3
| | | | | | | | | Will switch CCAPI to this new code later though, so as not to destabilize KfM and the Windows builds. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20769 dc483132-0cff-0310-8789-dd5450dbe970
* Use krb5 threading functions.Alexandra Ellwood2008-09-081-0/+1
| | | | | | | | | | | Remove use of ECODE since errors are no longer objects. Fixed bug where bundle error strings were not returned when homedir access was off. Switched to using UTF8 unconditionally. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20709 dc483132-0cff-0310-8789-dd5450dbe970
* CCAPI should only use one pthread keyAlexandra Ellwood2008-09-041-0/+5
| | | | | | | | | Use k5 thread functions. Also add destructors so if we ever have a way to detect application exit that the pthread key is destroyed. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20705 dc483132-0cff-0310-8789-dd5450dbe970
* Based on patch from lxs, with some changes:Ken Raeburn2008-08-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add several new gcc warning flags, used in the KfM build process. Put declarations before code. Fix a bunch of signed/unsigned type mixes, mostly by changing variable types to unsigned int. Fix constness in handling name of default ccache name. Make sure functions get declared with prototypes: krb5int_pthread_loaded krb5int_gmt_mktime krb5int_aes_encrypt krb5int_aes_decrypt gssint_mecherrmap_init gssint_mecherramp_get. Don't shadow global names: stat accept index open encrypt. Fix variable shadowing in LDAP ASN.1 support. Don't define unused krb5int_local_addresses. Don't export internal krb5_change_set_password. Fix error return indications from gssint_oid_to_mech. Create and use k5-gmt_mktime.h to provide one global declaration of krb5int_gmt_mktime, needed before we've generated krb5.h on some platforms. Not incorporated from initial patch: const changes in function signatures. ticket: 6096 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20697 dc483132-0cff-0310-8789-dd5450dbe970
* r820@NOME-KING: raeburn | 2008-08-26 18:37:41 -0400Ken Raeburn2008-08-271-374/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x r821@NOME-KING: raeburn | 2008-08-26 18:51:10 -0400 Remove disabled statistics gathering support. r822@NOME-KING: raeburn | 2008-08-26 18:57:20 -0400 Remove source location tracking. r823@NOME-KING: raeburn | 2008-08-26 19:05:35 -0400 Delete DEBUG_THREADS code. r824@NOME-KING: raeburn | 2008-08-26 19:18:59 -0400 Remove now-no-op assertion checks. r825@NOME-KING: raeburn | 2008-08-26 19:29:49 -0400 Simplify some wrappers. r826@NOME-KING: raeburn | 2008-08-26 19:38:23 -0400 Remove redundant comment. r827@NOME-KING: raeburn | 2008-08-26 19:49:20 -0400 When pthreads must be checked for at run time, don't include the no-op _nothread_mutex stuff too. r828@NOME-KING: raeburn | 2008-08-26 19:54:05 -0400 Remove remaining DEBUG_THREADS bits. r829@NOME-KING: raeburn | 2008-08-26 20:00:22 -0400 fix up initializer r830@NOME-KING: raeburn | 2008-08-26 20:10:37 -0400 Flatten a couple of structs wrapping single elements. r831@NOME-KING: raeburn | 2008-08-26 20:14:01 -0400 Remove k5_pthread_mutex_*lock macros. r832@NOME-KING: raeburn | 2008-08-26 20:19:14 -0400 Update comments a bit for lack of debug support. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20696 dc483132-0cff-0310-8789-dd5450dbe970
* Change non-debug version of k5_debug_log to int to silence someKen Raeburn2008-08-261-1/+1
| | | | | | compiler warnings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20695 dc483132-0cff-0310-8789-dd5450dbe970
* Fix sense of test of lock call preparing to update debug info inKen Raeburn2008-08-251-1/+1
| | | | | | | | | k5_mutex_destroy. Thanks, Ezra. ticket: 6090 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20690 dc483132-0cff-0310-8789-dd5450dbe970
* Modified hints APIs to be a single API that takes string keys.Alexandra Ellwood2008-08-191-0/+1
| | | | | | | | | | | Removed error object. Changed error message API to use thread specific data. Split out debugging API into separate files. ticket: 6055 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20670 dc483132-0cff-0310-8789-dd5450dbe970
* If krb5int_pthread_loaded is a function and we're using gcc, give it 'const' ↵Ken Raeburn2008-08-081-1/+6
| | | | | | attribute git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20637 dc483132-0cff-0310-8789-dd5450dbe970
* turn off thread-support debugging codeKen Raeburn2008-08-061-2/+2
| | | | | | | | | | | | With one big known exception having to do with exiting processes, I think we've shaken out most of the thread-related bugs that this code is going to catch in the existing code. It adds a lot of runtime code, so disable it for now, it can be enabled again for testing new changes. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20625 dc483132-0cff-0310-8789-dd5450dbe970
* If CONFIG_SMALL is defined, always use function calls for k5_mutex_lockKen Raeburn2008-08-061-1/+1
| | | | | | | | | and _unlock. On ppc darwin builds with debug info, this makes lib*.dylib a total of about 46K (~3%) smaller; "size" reports a reduction in text and/or "other" sizes for libgssapi_krb5, libkdb5, libkdb_ldap, and libkrb5. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20623 dc483132-0cff-0310-8789-dd5450dbe970
* A step towards ensuring we check mutex lock attempt results..Ken Raeburn2008-07-221-15/+12
| | | | | | | | | | | | | | | | Always use inline function k5_mutex_lock_1 instead of gcc statement expression, even under gcc. Under gcc 4, declane k5_mutex_lock_1 and krb5int_mutex_lock with attribute warn_unused_result. In k5_mutex_destroy macro, only store destroy code source+line if we succeed in temporarily locking the mutex. ticket: 5962 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20566 dc483132-0cff-0310-8789-dd5450dbe970
* Remove sched_yield usesKen Raeburn2008-04-241-56/+10
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20307 dc483132-0cff-0310-8789-dd5450dbe970
* Add a new per-thread datum for error message info in gssapi krb5 mechKen Raeburn2007-07-041-0/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19668 dc483132-0cff-0310-8789-dd5450dbe970
* On Solaris 10, define NO_WEAK_PTHREADS for the build. When that symbol isKen Raeburn2007-05-231-5/+9
| | | | | | | | | defined, skip the weak and conditional references in k5-thread.h and always use the real pthread functions. ticket: 5560 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19556 dc483132-0cff-0310-8789-dd5450dbe970
* Add a few comments on k5_mutex_t handlingKen Raeburn2007-04-131-1/+18
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19460 dc483132-0cff-0310-8789-dd5450dbe970
* (k5_mutex_lock_update_stats) [!DEBUG_THREADS_STATS && __GNUC__]: DeclareKen Raeburn2006-12-191-2/+3
| | | | | | | arguments with "unused" attribute. (k5_pthread_mutex_lock) [DEBUG_THREADS && __GNUC__]: Use __extension__. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18972 dc483132-0cff-0310-8789-dd5450dbe970
* Don't look for pthread_mutexattr_setrobust_npKen Raeburn2006-05-161-6/+7
| | | | | | | | | | Apparently Red Hat's Fedora Core 5 defines it but doesn't declare it, so we'd have to declare it before testing the address. While it was once useful for checking whether the pthread code had been loaded, I think the other tests done now are more effective and this isn't needed any more. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18012 dc483132-0cff-0310-8789-dd5450dbe970
* Partial merge from Novell LDAP integration branch, not including theKen Raeburn2006-04-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | actual LDAP bits: * include/kdb.h (krb5_db_entry_new): Add MASK field indicating what's changed. (KRB5_KDB_SRV_TYPE_*): New macros indicating which type of service is accessing the database. * lib/kadm5/srv/svr_principal.c: Set mask field. * lib/kadm5/srv/server_misc.c, server_init.c: Pass service type to krb5_db_open. * kadmin/dbutil/kdb5_stash.c (kdb5_stash): Pass service type to krb5_db_open. * kadmin/dbutil/kdb5_util.c (open_db_and_mkey): Pass service type to krb5_db_open. * kdc/main.c (init_realm): Pass service type to krb5_db_open. * lib/kadm5/srv/svr_principal.c: Set mask field. * kadmin/dbutil/dump.c (load_db): Pass service type to krb5_db_open. * lib/kdb/kdb5.h (KRB5_KDB_SRV_TYPE_*): New macros. * lib/kdb/err_handle.{c,h}: Deleted. * lib/kadm5/clnt/err_handle.{c,h}: Deleted. (krb5_db_clr_error): Declaration deleted. * lib/kdb/Makefile.in, lib/kadm5/clnt/Makefile.in: Don't build them. * lib/kdb/kdb5.c, lib/kadm5/clnt, lib/kadm5/srv: Use new error-message API. * kdc/do_tgs_req.c (process_tgs_req): Use new error-message API. * kdc/kdc_preauth.c (check_padata) * kdc/do_as_req.c (process_as_req): * kdc/main.c (init_realm): * kadmin/server/ovsec_kadmd.c (main, do_schpw): * schpw.c (process_chpw_request): * kadmin/server/server_stubs.c: * kadmin/cli/kadmin.c (extended_com_err_fn): New function. (kadmin_startup): Tell com_err library to use it, for kadmin.local. * lib/kdb/libkdb5.exports: Don't export krb5_db_clr_error. * lib/kdb/Makefile.in: (SRCS, STLIBOBJS): Don't build err_handle.c. * lib/kdb/kdb5.c (kdb_load_library): Don't pass argument to init_library. (krb5_db_clr_error): Function deleted. * lib/kdb/kdb5.h (struct _kdb_vftabl): Remove argument from init_library field. * lib/kadm5/logger.c (krb5_klog_init): Save the krb5_context pointer. (klog_com_err_proc): Use it, and call new error-message API. * lib/kadm5/srv/svr_principal.c: Use new error-message API. * kadmin/dbutil/kdb5_util.c (extended_com_err_fn): New function. (main): Tell com_err library to use it. * plugins/kdb/db2: Use new error-message APIs and updated DAL interface. * lib/kadm5/kadm_rpc.h: Delete err_str fields. * lib/kadm5/kadm_rpc_xdr.c: Don't process them. * kadmin/server/server_stubs.c: Don't use ret.err_str field. * include/k5-thread.h (k5_key_t): Deleted unused values. * lib/kdb/kdb5.h (KDB_MODULE_SECTION): Change db_modules to dbmodules. (KDB_MODULE_DEF_SECTION): New macro. * tests/Makefile.in (krb5.conf): Rename db_modules to dbmodules. * tests/dejagnu/config/default.exp (setup_krb5_conf): Likewise. * kadmin/testing/proto/krb5.conf.proto: Likewise. * lib/kdb/libkdb5.exports: Do export krb5_def_store_mkey. * lib/kadm5/admin.h (KADM5_CPW_FUNCTION, KADM5_RANDKEY_USED): New macros. (struct _kadm5_config_params): New field kpasswd_server. * lib/krb5/error_tables/kdb5_err.et (KRB5_KDB_SERVER_INTERNAL_ERR): New error code. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17899 dc483132-0cff-0310-8789-dd5450dbe970
* add/update copyright notices for non-trivial code additions/changes in 2006Ken Raeburn2006-01-261-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17621 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (krb5int_mutex_alloc, krb5int_mutex_free, krb5int_mutex_lock,Ken Raeburn2006-01-251-0/+21
| | | | | | | | | | | krb5int_mutex_unlock): Declare. (k5_mutex_lock, k5_mutex_unlock) [PLUGIN]: Redefine to call krb5int_ function versions. ticket: 3417 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17610 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (USE_PTHREAD_LOCK_ONLY_IF_LOADED): Define any timeKen Raeburn2005-12-171-4/+1
| | | | | | | | | HAVE_PRAGMA_WEAK_REF is defined. ticket: 3293 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17563 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_mutex_lock_update_stats) [__GNUC__]: Use an inline function,Ken Raeburn2005-12-071-1/+8
| | | | | | to avoid "statement with no effect" warnings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17554 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_key_t): Add K5_KEY_KDB_ERR_HANDLER and ↵Ken Raeburn2005-07-021-0/+2
| | | | | | K5_KEY_KADM_CLNT_ERR_HANDLER git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17287 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (krb5int_pthread_loaded) [HAVE_PRAGMA_WEAK_REF]: Declare.Ken Raeburn2005-06-011-8/+4
| | | | | | | | | (K5_PTHREADS_LOADED) [HAVE_PRAGMA_WEAK_REF]: Use it. ticket: 3084 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17224 dc483132-0cff-0310-8789-dd5450dbe970
* Irix k5_os_mutex_lock calls k5_pthread_mutex_lock w/ wrong argEzra Peisach2005-01-221-3/+3
| | | | | | | | | | | | | | | | * k5-thread.h (k5_os_mutex_lock): Under Irix, invoke k5_pthread_mutex_lock() with the k5_os_mutex, not the pthread_mutex_t. (k5_pthread_assert_locked,unlocked): If DEBUG_THREADS not used, provide correct prototype. Add missing close paren. Test programs show that under irix, the mutex locking/unlocking code was working - even with the wrong memory use... I do not understand why. ticket: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17062 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h [HAVE_PTHREAD && HAVE_PRAGMA_WEAK_REF]: Mark pthread_self andKen Raeburn2005-01-141-0/+2
| | | | | | | | | pthread_equal as weak references. ticket: 2878 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17041 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_pthread_assert_locked): Only call pthread_equal ifKen Raeburn2005-01-141-5/+7
| | | | | | | | | | | thread support is loaded. (k5_pthread_mutex_unlock): Use k5_pthread_assert_locked instead of duplicating it. ticket: 2878 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17036 dc483132-0cff-0310-8789-dd5450dbe970
* More paranoid checking...Ken Raeburn2005-01-141-26/+74
| | | | | | | | | | | | | | | | | | | | | | | | | * k5-thread.h (k5_os_mutex) [pthread case]: Add new field "owner" if DEBUG_THREADS. (k5_pthread_mutex_lock, k5_pthread_mutex_unlock, k5_pthread_assert_locked): New macros/functions; if DEBUG_THREADS, set or check the owner field. (K5_OS_MUTEX_PARTIAL_INITIALIZER) [pthread case && DEBUG_THREADS]: Set the owner field. If PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP is defined, use it. (k5_os_mutex_lock, k5_os_mutex_unlock, k5_os_mutex_assert_locked) [pthread case]: Use k5_pthread_ versions. (k5_mutex_destroy): Update the location data with the mutex locked, before destroying it. (k5_mutex_unlock): Update the location data while the mutex is still locked, and check the assertion that the mutex really is locked. Convert inline function to macro. * k5-thread.h (krb5int_mutex_lock_update_stats, krb5int_mutex_unlock_update_stats, krb5int_mutex_report_stats) [!DEBUG_THREADS_STATS]: Declare KRB5_CALLCONV. ticket: 2878 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17031 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (KRB5_CALLCONV, KRB5_CALLCONV_C): Define if not defined.Ken Raeburn2005-01-091-2/+16
| | | | | | | | | (krb5int_mutx_lock_update_stats, krb5int_mutex_unlock_update_stats, krb5int_mutex_report_stats) [!DEBUG_THREADS_STATS]: Declare, with KRB5_CALLCONV. (k5_debug_make_loc): Change "lineno" to type int. (k5_debug_make_loc): Likewise for argument "line". git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17012 dc483132-0cff-0310-8789-dd5450dbe970
* hooks for recording statistics on locking behaviorKen Raeburn2004-12-061-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finish the hooks (left disabled by default) for logging somewhere the recorded timing behavior relating to the use of locks in the krb5 code. Currently, "reporting" means writing to /dev/tty or stderr, and the data is the number of times a mutex is locked, file and line where it was created, min/avg/max/stddev wait times to acquire the lock and hold times, and stats are only written out for locks that were locked a certain minimum number of times and with a minimum average wait time. The criteria are all controlled in threads.c, and k5-thread.h just has the hooks for gathering data. So turning on/off the data gathering requires a full rebuild, but tweaking the reporting is mostly just a relinking pass. (May also require adding a dependence on the math library to the support library; for a static build that may impact a lot of makefiles.) * include/k5-thread.h [DEBUG_THREADS_STATS]: Include string.h and inttypes.h. (get_current_time) [DEBUG_THREADS_STATS]: Define as inline. (k5_mutex_init_stats) [DEBUG_THREADS_STATS]: Save away current time as creation time. (k5_mutex_stats_tmp): New typedef, k5_debug_time_t if recording stats, dummy int otherwise. (k5_mutex_stats_start): New macro, get current time if recording, zero otherwise. (krb5int_mutex_lock_update_stats, krb5int_mutex_unlock_update_stats, krb5int_mutex_report_stats) [DEBUG_THREADS_STATS]: Declare. (krb5int_mutex_report_stats) [! DEBUG_THREADS_STATS]: New macro, does nothing. (k5_mutex_lock_update_stats, k5_mutex_unlock_update_stats): New macros, map to krb5int_ functions if recording, dummy statements otherwise. (k5_mutex_destroy): Call krb5int_mutex_report_stats. (k5_mutex_lock, k5_mutex_lock_1): Call k5_mutex_stats_start and k5_mutex_lock_update_stats. (k5_mutex_unlock_1): Call k5_mutex_unlock_update_stats. * util/support/threads.c [DEBUG_THREADS_STATS]: Include stdio.h. (stats_logfile) [DEBUG_THREADS_STATS]: New variable. (krb5int_thread_support_init) [DEBUG_THREADS_STATS]: Set it to point to a file on /dev/tty or stderr. (krb5int_thread_support_fini) [DEBUG_THREADS_STATS]: Flush it. (k5_mutex_lock_update_stats, krb5int_mutex_unlock_update_stats, get_stddev, krb5int_mutex_report_stats) [DEBUG_THREADS_STATS]: New functions. * util/support/libkrb5support.exports: Add krb5int_mutex_*_stats. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16913 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (return_after_yield, k5_mutex_lock) [__GNUC__]: Add macroKen Raeburn2004-10-281-1/+21
| | | | | | | versions so debugging line numbers will be useful. (DEBUG_THREADS_SLOW): Don't define. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16842 dc483132-0cff-0310-8789-dd5450dbe970
* Fix Tru64 build:Ken Raeburn2004-08-151-6/+6
| | | | | | | | * k5-thread.h (k5_os_nothread_mutex_assert_locked, k5_os_nothread_mutex_assert_unlocked, k5_os_mutex_assert_locked, k5_os_mutex_assert_unlocked): Assertion macros should always have type void. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16663 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_os_nothread_mutex_finish_init, k5_os_nothread_mutex_init,Ken Raeburn2004-08-131-25/+53
| | | | | | | | | | | | | | k5_os_nothread_mutex_destroy, k5_os_nothread_mutex_lock, k5_os_nothread_mutex_unlock) [!DEBUG_THREADS]: Replace macros with inline functions, to gain type checking and eliminate gratuitous compiler warnings. (k5_pthread_assert_unlocked, k5_pthread_assert_locked): Likewise. (k5_os_mutex_finish_init) [HAVE_PTHREAD && !USE_PTHREAD_LOCK_ONLY_IF_LOADED]: Likewise. (return_after_yield): New inline function. (k5_os_mutex_lock) [HAVE_PTHREAD]: Change back to a macro, calling return_after_yield. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16661 dc483132-0cff-0310-8789-dd5450dbe970
* * configure.in: Look for sched.h and sched_yield.Ken Raeburn2004-08-071-2/+7
| | | | | | | | | * k5-thread.h: Only include sched.h if it's available. (MAYBE_SCHED_YIELD): Only use sched_yield if sched.h and sched_yield are available; if weak references are supported and sched_yield isn't available by default, check for it at run time. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16645 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h [HAVE_PTHREAD]: Include sched.h if DEBUG_THREADS_SLOW is defined.Ken Raeburn2004-08-051-10/+30
| | | | | | | | | (MAYBE_SCHED_YIELD) [HAVE_PTHREAD]: Define, to call sched_yield or not, depending on DEBUG_THREADS_SLOW. (k5_os_mutex_lock, k5_os_mutex_unlock) [HAVE_PTHREAD]: Use MAYBE_SCHED_YIELD. (DEBUG_THREADS_SLOW): Define. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16642 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h [HAVE_PRAGMA_WEAK_REF]: Declare the pthread mutex functions asKen Raeburn2004-07-281-0/+8
| | | | | | | | weak. (USE_PTHREAD_LOCK_ONLY_IF_LOADED): Define if pthread_mutex_lock isn't available by default. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16625 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_key_t): Add a couple new values for GSSAPI ccache name ↵Ken Raeburn2004-07-141-0/+2
| | | | | | manipulation git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16588 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_os_mutex_init, k5_os_mutex_destroy): IfKen Raeburn2004-07-141-2/+6
| | | | | | | USE_PTHREAD_LOCK_ONLY_IF_LOADED is defined, use pthread_mutex_init and _destroy only if pthread support is loaded. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16587 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_os_mutex_lock, k5_os_mutex_unlock, k5_os_mutex_assert_locked,Ken Raeburn2004-07-111-4/+4
| | | | | | | k5_os_mutex_assert_unlocked) [USE_PTHREAD_LOCK_ONLY_IF_LOADED]: Fix typo in accessing non-pthread versions. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16580 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h: Test HAVE_PTHREAD instead of HAVE_PTHREAD_HKen Raeburn2004-07-091-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16573 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h [! HAVE_PTHREAD_H]: Don't explicitly disable thread support whenKen Raeburn2004-07-071-5/+40
| | | | | | | | | | pthread.h is missing. (k5_os_mutex, K5_OS_MUTEX_PARTIAL_INITIALIZER, k5_os_mutex_finish_init, k5_os_mutex_init, k5_os_mutex_destroy, k5_os_mutex_lock, k5_os_mutex_unlock, k5_os_mutex_assert_unlocked, k5_os_mutex_assert_locked) [_WIN32]: Define Windows versions; still not enabled by default. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16552 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h: Use K5_THREAD_H for multiple inclusion protection.Ken Raeburn2004-07-071-3/+65
| | | | | | | | | | | (k5_debug_mutex_stats, k5_mutex_init_stats, k5_mutex_finish_init_stats, K5_MUTEX_STATS_INIT): Add some dummy support for recording statistics on how long mutexes are held, etc. Incomplete implementation started, but code not enabled. (k5_mutex_t): Add statistics field. (K5_MUTEX_PARTIAL_INITIALIZER, k5_mutex_init_1, k5_mutex_init): Initialize it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16550 dc483132-0cff-0310-8789-dd5450dbe970