diff options
author | Chris Hall (GMCH) <chris.hall@highwayman.com> | 2009-12-17 17:09:29 +0000 |
---|---|---|
committer | Chris Hall (GMCH) <chris.hall@highwayman.com> | 2009-12-17 17:09:29 +0000 |
commit | b53c5c3b32a421339bd8414b223d5bfeab950f8b (patch) | |
tree | 09407af5a575b72e4d5d8085d4150325bff64b47 /lib/qpthreads.h | |
parent | 29e6ad6c07992d6a947d739d1665a95e817e6e9b (diff) | |
download | quagga-b53c5c3b32a421339bd8414b223d5bfeab950f8b.tar.bz2 quagga-b53c5c3b32a421339bd8414b223d5bfeab950f8b.tar.xz |
Add qpt_threads_equal() to lib/qpthreads
All qpt_thread_t values are equal if !qpthreads_enabled.
Diffstat (limited to 'lib/qpthreads.h')
-rw-r--r-- | lib/qpthreads.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/qpthreads.h b/lib/qpthreads.h index 49a7c1e3..361271ff 100644 --- a/lib/qpthreads.h +++ b/lib/qpthreads.h @@ -137,13 +137,21 @@ qpt_freeze_qpthreads_enabled(void) ; /* get and freeze qpthreads_enabled */ /*============================================================================== * Thread self knowledge -- returns 'NULL' if !qpthreads_enabled */ - Inline qpt_thread_t qpt_thread_self(void) { return qpthreads_enabled ? pthread_self() : (qpt_thread_t)NULL; } ; /*============================================================================== + * Thread equality -- returns non-zero (true) if threads are *equal* + * -- all threads are equal if !qpthreads_enabled + */ +Inline int qpt_threads_equal(qpt_thread_t a, qpt_thread_t b) +{ + return !qpthreads_enabled || pthread_equal(a, b) ? 1 : 0 ; +} ; + +/*============================================================================== * Mutex handling. * * Quagga's default mutex type is: |