summaryrefslogtreecommitdiffstats
path: root/src/include/k5-thread.h
Commit message (Collapse)AuthorAgeFilesLines
...
* * 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
* * k5-thread.h: Restructured mutex code.Ken Raeburn2004-07-021-175/+278
| | | | | | | | | | | | | | | (k5_debug_loc): New type, may contain file/line info if DEBUG_THREADS_LOC is defined. (k5_os_nothread_*): Dummy implementation of mutex lock for a single-threded process. Uses a flag and assert() if DEBUG_THREADS is defined, does nothing interesting otherwise. (k5_os_mutex*, k5_once*): General implementations, with dummy or POSIX or POSIX-if-loaded-otherwise-dummy variants. (k5_mutex_*): Combine OS-specific mutex implementation with optional file/line tracking, and provide a place to instrument for other debugging or performance data. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16539 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (K5_MUTEX_DEBUG_INITIALIZER): Use current file and line.Ken Raeburn2004-07-011-10/+14
| | | | | | | | | | | | | (k5_mutex_debug_finish_init, k5_mutex_debug_init, k5_mutex_debug_destroy): Save current file and line. (k5_mutex_debug_lock): Verify that the lock was unlocked before, and set the state to locked. (k5_mutex_debug_unlock): Verify that the mutex was locked before, and set the state to unlocked. (k5_debug_assert_locked, k5_debug_assert_unlocked): Use k5_mutex_debug_check_init instead of checking initialized==1. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16535 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h (k5_debug_assert_locked, k5_debug_assert_unlocked): New macros.Ken Raeburn2004-06-301-0/+15
| | | | | | | (k5_assert_locked, k5_assert_unlocked): New macros, may or may not call the debug macros. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16533 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h: Error out at compile time if thread support is enabled but theKen Raeburn2004-06-021-0/+20
| | | | | | | | thread system isn't pthreads. (This is after the code disabling thread support for non-pthreads systems, so it's a placeholder for now that should never get invoked.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16393 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h: On IRIX, with threads enabled, reject gcc older than v3Ken Raeburn2004-05-131-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16330 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h: On IRIX, if gcc is older than v3, tell the user to get a newerKen Raeburn2004-05-131-1/+4
| | | | | | | | | one, and error out. (We need weak reference support for pthread_once, gcc 2.95 doesn't support them, but gcc 3, which has been out for nearly 3 years, does.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16329 dc483132-0cff-0310-8789-dd5450dbe970
* Update mutex debug code to be somewhat compatible with multi-threadedKen Raeburn2004-05-011-24/+28
| | | | | | | | | | | | | | | | | execution. It won't be as useful in single-threaded programs for detecting bugs in the mutex handling for now, though. * k5-thread.h (k5_mutex_debug_check_init, k5_mutex_debug_update_loc): New macros. (k5_mutex_debug_lock, k5_mutex_debug_unlock): Use them. (k5_mutex_lock, k5_mutex_unlock) [ENABLE_THREADS && DEBUG_THREADS]: Use them instead of k5_mutex_debug_lock and k5_mutex_debug_unlock. (enum k5_mutex_debug_states): New enum. (K5_MUTEX_DEBUG_LOCKED, K5_MUTEX_DEBUG_UNLOCKED): Change to enumerator values. (k5_mutex_debug_info): Use the enum type. Reorder fields. (K5_MUTEX_DEBUG_INITIALIZER): Update for new field order. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16293 dc483132-0cff-0310-8789-dd5450dbe970
* Added support for library initialization and finalization, and verificationKen Raeburn2004-04-241-27/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | that the initializer completed successfully. Delay initialization on POSIX until the first "verification" call. Currently specific to a few platforms, but should still build on others without thread support enabled. Use it to finish creating (if necessary) and destroy mutexes, and free some other storage "permanently" allocated by libraries (currently, libkrb5 cache/keytab type registries only). Change initialization of static mutexes to a two-step operation, a static "partial" initializer and a "finish_init" routine called from a thread-safe environment like library initialization is assumed to be. POSIX will use the former, Windows will use the latter, and the debug support will check that *both* have been used. Added init/fini functions to com_err, profile, krb5, and gssapi libraries. (The profile library one may need to be removed later.) The existing ones, not thread-safe, are still around. Use weak symbol support if available to figure out if the pthread library has been linked in, and avoid calling certain routines if the C library stubs are known not to exist or work. Stub declarations for thread-specific data. Minor bugfixes, whitespace changes. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16268 dc483132-0cff-0310-8789-dd5450dbe970
* fix debug initializer and copyrightKen Raeburn2004-03-061-3/+29
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16152 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-thread.h: New fileKen Raeburn2004-03-061-0/+147
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16148 dc483132-0cff-0310-8789-dd5450dbe970