summaryrefslogtreecommitdiff
path: root/src/dbinc/shqueue.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-02-17 17:25:57 +0000
committer <>2015-03-17 16:26:24 +0000
commit780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch)
tree598f8b9fa431b228d29897e798de4ac0c1d3d970 /src/dbinc/shqueue.h
parent7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff)
downloadberkeleydb-master.tar.gz
Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz.HEADdb-6.1.23master
Diffstat (limited to 'src/dbinc/shqueue.h')
-rw-r--r--src/dbinc/shqueue.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/dbinc/shqueue.h b/src/dbinc/shqueue.h
index 22464462..20e0fae7 100644
--- a/src/dbinc/shqueue.h
+++ b/src/dbinc/shqueue.h
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -140,6 +140,17 @@ struct { \
((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next)))
/*
+ * __SH_LIST_WAS_EMPTY is private API. SH_LIST_FIRST is not thread-safe;
+ * the slh_first field could be evaluated multiple times if the optimizer
+ * does not eliminate the second load. __SH_LIST_WAS_EMPTY tests whether a
+ * prior call of SH_LIST_FIRSTP occurred while the list was empty; i.e., its
+ * relative offset was -1. It is thread-safe to call SH_LIST_FIRSTP and then
+ * test the resulting pointer with __SH_LIST_WAS_EMPTY.
+ */
+#define __SH_LIST_WAS_EMPTY(head, ptr) \
+ ((u_int8_t *)(ptr) == (((u_int8_t *)(head)) + (-1)))
+
+ /*
*__SH_LIST_PREV_OFF is private API. It calculates the address of
* the elm->field.sle_next member of a SH_LIST structure. All offsets
* between elements are relative to that point in SH_LIST structures.