aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2004-10-28 05:40:00 +0000
committerKen Raeburn <raeburn@mit.edu>2004-10-28 05:40:00 +0000
commitfeda786fecdae0c2851312f16adb3b91e477e9f7 (patch)
treeea98fb8e80d1bb18fd569dca8123e64c2d7ff7e3
parentbbabacbf092958c7e9c0e61f8929330cf5671625 (diff)
downloadkrb5-feda786fecdae0c2851312f16adb3b91e477e9f7.zip
krb5-feda786fecdae0c2851312f16adb3b91e477e9f7.tar.gz
krb5-feda786fecdae0c2851312f16adb3b91e477e9f7.tar.bz2
* k5-thread.h (return_after_yield, k5_mutex_lock) [__GNUC__]: Add macro
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
-rw-r--r--src/include/ChangeLog6
-rw-r--r--src/include/k5-thread.h22
2 files changed, 27 insertions, 1 deletions
diff --git a/src/include/ChangeLog b/src/include/ChangeLog
index 9be4bbb..f3e2ae9 100644
--- a/src/include/ChangeLog
+++ b/src/include/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-28 Ken Raeburn <raeburn@mit.edu>
+
+ * k5-thread.h (return_after_yield, k5_mutex_lock) [__GNUC__]: Add
+ macro versions so debugging line numbers will be useful.
+ (DEBUG_THREADS_SLOW): Don't define.
+
2004-10-05 Ken Raeburn <raeburn@mit.edu>
* fake-addrinfo.h (AI_ADDRCONFIG, AI_V4MAPPED, AI_ALL): If not
diff --git a/src/include/k5-thread.h b/src/include/k5-thread.h
index 5d13093..5fecf08 100644
--- a/src/include/k5-thread.h
+++ b/src/include/k5-thread.h
@@ -139,7 +139,7 @@
#define DEBUG_THREADS
#define DEBUG_THREADS_LOC
-#define DEBUG_THREADS_SLOW /* permit debugging stuff that'll slow things down */
+#undef DEBUG_THREADS_SLOW /* debugging stuff that'll slow things down? */
#undef DEBUG_THREADS_STATS
#include <assert.h>
@@ -464,11 +464,20 @@ static inline void k5_pthread_assert_locked(pthread_mutex_t *m) { }
the invoking site via a macro; once it returns, the inline function
is called (with messed-up line-number info for gdb hopefully
localized to just that call). */
+#ifdef __GNUC__
+#define return_after_yield(R) \
+ __extension__ ({ \
+ int _r = (R); \
+ MAYBE_SCHED_YIELD(); \
+ _r; \
+ })
+#else
static inline int return_after_yield(int r)
{
MAYBE_SCHED_YIELD();
return r;
}
+#endif
#ifdef USE_PTHREAD_LOCK_ONLY_IF_LOADED
@@ -607,6 +616,16 @@ static inline int k5_mutex_finish_init_1(k5_mutex_t *m, k5_debug_loc l)
(k5_os_mutex_assert_unlocked(&(M)->os), \
(M)->loc_last = K5_DEBUG_LOC, \
k5_os_mutex_destroy(&(M)->os))
+#ifdef __GNUC__
+#define k5_mutex_lock(M) \
+ __extension__ ({ \
+ int _err = 0; \
+ k5_mutex_t *_m = (M); \
+ _err = k5_os_mutex_lock(&_m->os); \
+ if (_err == 0) _m->loc_last = K5_DEBUG_LOC; \
+ _err; \
+ })
+#else
static inline int k5_mutex_lock_1(k5_mutex_t *m, k5_debug_loc l)
{
int err = 0;
@@ -617,6 +636,7 @@ static inline int k5_mutex_lock_1(k5_mutex_t *m, k5_debug_loc l)
return err;
}
#define k5_mutex_lock(M) k5_mutex_lock_1(M, K5_DEBUG_LOC)
+#endif
static inline int k5_mutex_unlock_1(k5_mutex_t *m, k5_debug_loc l)
{
int err = 0;