Samy Al Bahra 10 years ago
commit d2c297deed

@ -1,4 +1,4 @@
Copyright 2010-2013 Samy Al Bahra.
Copyright 2010-2014 Samy Al Bahra.
Copyright 2011-2013 AppNexus, Inc.
All rights reserved.

@ -2,8 +2,8 @@ CC=@CC@
MAKE=make
SRC_DIR=@SRC_DIR@
BUILD_DIR=@BUILD_DIR@
CFLAGS=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include
LDFLAGS=@LDFLAGS@
CFLAGS+=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include
LDFLAGS+=@LDFLAGS@
ALL_LIBS=@ALL_LIBS@
LD=@LD@

@ -1 +1,2 @@
CFLAGS+=-m64 -D__ppc64__
LDFLAGS+=-m64

@ -1 +1,2 @@
CFLAGS+=-m32 -D__x86__ -msse -msse2
LDFLAGS+=-m32

@ -1 +1,2 @@
CFLAGS+=-m64 -D__x86_64__
LDFLAGS+=-m64

49
configure vendored

@ -34,7 +34,7 @@ WANT_PIC=yes
P_PWD=`pwd`
MAINTAINER='sbahra@repnop.org'
VERSION=${VERSION:-'0.4.2'}
VERSION=${VERSION:-'0.4.5'}
VERSION_MAJOR='0'
BUILD="$PWD/build/ck.build"
PREFIX=${PREFIX:-"/usr/local"}
@ -42,6 +42,8 @@ LDNAME="libck.so"
LDNAME_VERSION="libck.so.$VERSION"
LDNAME_MAJOR="libck.so.$VERSION_MAJOR"
OPTION_CHECKING=1
export CFLAGS
export PREFIX
LC_ALL=C
@ -142,8 +144,18 @@ generate_stdout()
echo "Documentation will be installed in $MANDIR"
}
for option in $*; do
value=`echo "$option" | sed -e 's/^[^=]*=\(.*\)/\1/'`
for option; do
case "$option" in
*=?*)
value=`expr -- "$option" : '[^=]*=\(.*\)'`
;;
*=)
value=
;;
*)
value=yes
;;
esac
case "$option" in
--help)
@ -224,21 +236,26 @@ for option in $*; do
--without-pic)
WANT_PIC=no
;;
--disable-option-checking)
OPTION_CHECKING=0
;;
--build=*|--host=*|--target=*|--exec-prefix=*|--bindir=*|--sbindir=*|\
--sysconfdir=*|--datadir=*|--libexecdir=*|--localstatedir=*|\
--enable-static|\
--sharedstatedir=*|--infodir=*|--enable-shared|--disable-shared)
--sharedstatedir=*|--infodir=*|--enable-shared|--disable-shared|\
--cache-file=*|--srcdir=*)
# ignore for compat with regular configure
;;
--*)
echo "$0 [--help]"
echo "Unknown option $option"
exit $EXIT_FAILURE
if test "$OPTION_CHECKING" -eq 1; then
echo "$0 [--help]"
echo "Unknown option $option"
exit $EXIT_FAILURE
fi
;;
*=*)
NAME=`expr "$option" : '\([^=]*\)='`
VALUE=`echo "$value" | sed "s/'/'\\\\\\\\''/g"`
eval "$NAME='$VALUE'"
NAME=`expr -- "$option" : '\([^=]*\)='`
eval "$NAME='$value'"
export $NAME
;;
*)
@ -401,7 +418,7 @@ case $PLATFORM in
"i86pc")
RTM_ENABLE="CK_MD_RTM_DISABLE"
MM="${MM:-"CK_MD_TSO"}"
ISA=`isainfo -n 2> /dev/null || echo i386`
if test -z "$ISA"; then ISA=`isainfo -n 2> /dev/null || echo i386` ; fi
case "$ISA" in
"amd64")
RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"}
@ -415,7 +432,7 @@ case $PLATFORM in
;;
esac
;;
"ppc64")
"ppc64"|"ppc64le")
RTM_ENABLE="CK_MD_RTM_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
PLATFORM=ppc64
@ -427,6 +444,12 @@ case $PLATFORM in
PLATFORM=arm
ENVIRONMENT=32
;;
"aarch64")
RTM_ENABLE="CK_MD_RTM_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
PLATFORM=aarch64
ENVIRONMENT=64
;;
*)
RTM_ENABLE="CK_MD_RTM_DISABLE"
PLATFORM=
@ -576,7 +599,7 @@ elif test "$COMPILER" = "gcc" || test "$COMPILER" = "clang" || test "$COMPILER"
INSTALL_LIBS="install-lib"
fi
CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS"
CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS"
PTHREAD_CFLAGS="-pthread"
if test "$COMPILER" = "mingw64"; then
ENVIRONMENT=64

@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
.Sh DESCRIPTION
Until a cohort instance is initialized using the CK_COHORT_INIT macro, any operations
involving it will have undefined behavior. After this macro has been called, the cohort
pointed to by the
pointed to by the
.Fa cohort
argument will use the lock pointed to by
.Fa global_lock
@ -48,8 +48,8 @@ as its local lock.
.Pp
The cohort will relinquish its global lock after
.Fa pass_limit
consecutive acquisitions of its local lock, even if there are other threads waiting.
If you are unsure of a value to use for the
consecutive acquisitions of its local lock, even if there are other threads waiting.
If you are unsure of a value to use for the
.Fa pass_limit
argument, you should use CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT.
.Sh SEE ALSO

@ -38,11 +38,11 @@ Concurrency Kit (libck, \-lck)
.Sh DESCRIPTION
This call attempts to acquire both the local and global (if necessary) locks from
.Fa cohort .
The call will block until both locks have been acquired.
The call will block until both locks have been acquired.
.Fa global_context
will be passed as the second argument to the function that was provided as the
will be passed as the second argument to the function that was provided as the
.Fa global_lock_method
argument to CK_COHORT_PROTOTYPE if that method is called, and
argument to CK_COHORT_PROTOTYPE if that method is called, and
.Fa local_context
will be passed to the function specified by
.Fa local_lock_method

@ -37,7 +37,7 @@ Concurrency Kit (libck, \-lck)
"LOCK_FXN global_unlock_method" "LOCK_FXN local_lock_method" "LOCK_FXN local_unlock_method"
.Sh DESCRIPTION
The ck_cohort.h header file does not define any cohort types. Instead, the user must use
the CK_COHORT_PROTOTYPE or
the CK_COHORT_PROTOTYPE or
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
macros to define any types they want to use. They must use CK_COHORT_TRYLOCK_PROTOTYPE
if they want their cohort type to support trylock operations.

@ -38,18 +38,18 @@ Concurrency Kit (libck, \-lck)
.Sh DESCRIPTION
This call attempts to acquire both the local and global (if necessary) locks from
.Fa cohort .
It can only be used with cohort types that were defined using the
It can only be used with cohort types that were defined using the
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
macro. The call will not block and will return a bool that will evaluate to true iff
the cohort was successfully acquired.
the cohort was successfully acquired.
.Fa global_trylock_context
will be passed as the second argument to the function that was provided as the
will be passed as the second argument to the function that was provided as the
.Fa global_trylock_method
argument to CK_COHORT_TRYLOCK_PROTOTYPE if that method is called, and
argument to CK_COHORT_TRYLOCK_PROTOTYPE if that method is called, and
.Fa local_trylock_context
will be passed to the function specified by
.Fa local_trylock_method .
If the global lock acquisition fails, then the cohort will immediately release its
If the global lock acquisition fails, then the cohort will immediately release its
local lock as well, and
.Fa local_unlock_context
will be passed to the function specified by

@ -57,7 +57,7 @@ of the other CK_COHORT macros.
: This method should return true iff the global lock is acquired by a thread.
.br
.Fa global_trylock_method
: The method that should be called to try to acquire the global lock.
: The method that should be called to try to acquire the global lock.
It should not block and return true iff the lock was successfully acquired.
.br
.Fa local_lock_method
@ -70,7 +70,7 @@ It should not block and return true iff the lock was successfully acquired.
: This method should return true iff the global lock is acquired by a thread.
.br
.Fa local_trylock_method
: The method that should be called to try to acquire the local lock.
: The method that should be called to try to acquire the local lock.
It should not block and return true iff the lock was successfully acquired.
.Pp
Instances of the defined cohort type can be declared as:

@ -38,11 +38,11 @@ Concurrency Kit (libck, \-lck)
.Sh DESCRIPTION
This call instructs
.Fa cohort
to relinquish its local lock and potentially its global lock as well.
to relinquish its local lock and potentially its global lock as well.
.Fa global_context
will be passed as the second argument to the function that was provided as the
will be passed as the second argument to the function that was provided as the
.Fa global_lock_method
argument to CK_COHORT_PROTOTYPE if that method is called, and
argument to CK_COHORT_PROTOTYPE if that method is called, and
.Fa local_context
will be passed to the function specified by
.Fa local_lock_method

@ -0,0 +1,71 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd March 28, 2012
.Dt CK_RHS_HASH 3
.Sh NAME
.Nm CK_RHS_HASH
.Nd invoke hash function with hash set seed
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft unsigned long
.Fn CK_RHS_HASH "ck_rhs_t *hs" "ck_rhs_hash_cb_t *hf" "const void *key"
.Sh DESCRIPTION
The
.Fn CK_RHS_HASH 3
macro will invoke the hash function pointed to by the
.Fa hf
argument with the seed value associated with
.Fa hs
and the key pointer specified by the
.Fa key
argument.
.Sh RETURN VALUES
This function will return the value returned by the
.Fa hf
function.
.Sh ERRORS
It is expected
.Fa hs
was previously initialized via
.Fn ck_rhs_init 3 .
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -40,11 +40,11 @@ Concurrency Kit (libck, \-lck)
This macro initializes the lock instance pointed to by the
.Fa lock
argument. Until a lock instance is initialized using the CK_RWCOHORT_INIT macro, any operations
involving it will have undefined behavior. Note that the
involving it will have undefined behavior. Note that the
.Fa wait_limit
argument should only be used with reader-preference or writer-preference locks. For neutral
locks, this argument should be excluded.
If you are unsure of a value to use for the
If you are unsure of a value to use for the
.Fa wait_limit
argument, you should use CK_RWCOHORT_STRATEGY_DEFAULT_LOCAL_WAIT_LIMIT.
.Sh SEE ALSO

@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
.Fn CK_RWCOHORT_WP_INSTANCE "COHORT_NAME cohort_name"
.Sh DESCRIPTION
The user must use this macro to declare instances of lock types that they have
defined using the
defined using the
.Xr CK_RWCOHORT_PROTOTYPE 3
macro. The cohort_name must be the same as the one used in the prototype macro.
macro. The cohort_name must be the same as the one used in the prototype macro.
For instance, if CK_RWCOHORT_PROTOTYPE was called with the name "foo", the
CK_RWCOHORT_INSTANCE macro should be called as
.br

@ -41,9 +41,9 @@ The ck_rwcohort.h header file does not define any cohort types. Instead, the us
the CK_RWCOHORT_PROTOTYPE macro to define any types they want to use.
This macro takes a single argument which corresponds to the type of the cohort lock that
the reader-writer lock should use. A cohort type must have already been defined with that name
using the
using the
.Xr CK_COHORT_PROTOTYPE 3
or
or
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
macros.
.Pp

@ -33,24 +33,24 @@
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_cohort.h
.Fn CK_RWCOHORT_NEUTRAL_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_NEUTRAL_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_RP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_RP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_WP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_WP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Sh DESCRIPTION
This call will acquire read-only permission from
.Fa lock .
The call will block until this permission has been acquired.
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
The call will block until this permission has been acquired.
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
.Fa lock .
The
.Fa global_context
.Fa global_context
and
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa cohort .
.
.Sh SEE ALSO

@ -33,23 +33,23 @@
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_cohort.h
.Fn CK_RWCOHORT_NEUTRAL_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_NEUTRAL_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_RP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_RP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_WP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_WP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Sh DESCRIPTION
This call will relinquish read-only permission to
.Fa lock .
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
.Fa lock .
The
.Fa global_context
.Fa global_context
and
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa cohort .
.
.Sh SEE ALSO

@ -33,24 +33,24 @@
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_cohort.h
.Fn CK_RWCOHORT_NEUTRAL_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_NEUTRAL_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_RP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_RP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_WP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_WP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Sh DESCRIPTION
This call will acquire write permission for
.Fa lock .
The call will block until this permission has been acquired.
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
The call will block until this permission has been acquired.
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
.Fa lock .
The
.Fa global_context
.Fa global_context
and
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa cohort .
.
.Sh SEE ALSO

@ -33,23 +33,23 @@
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_cohort.h
.Fn CK_RWCOHORT_NEUTRAL_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_NEUTRAL_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_RP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_RP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Fn CK_RWCOHORT_WP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
.Fn CK_RWCOHORT_WP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
"void *global_context" "void *local_context"
.Sh DESCRIPTION
This call will relinquish write permission for
.Fa lock .
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
.Fa cohort
must point to a cohort whose global lock is the same as all other cohorts used with
.Fa lock .
The
.Fa global_context
.Fa global_context
and
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa local_context
arguments will be passed along as the context arguments to any calls to
.Fa cohort .
.
.Sh SEE ALSO

@ -48,6 +48,7 @@ OBJECTS=CK_ARRAY_FOREACH \
ck_bitmap_init \
ck_bitmap_reset \
ck_bitmap_set \
ck_bitmap_bts \
ck_bitmap_test \
ck_bitmap_base \
ck_bitmap_union \
@ -73,6 +74,7 @@ OBJECTS=CK_ARRAY_FOREACH \
ck_hs_init \
ck_hs_destroy \
CK_HS_HASH \
ck_hs_apply \
ck_hs_iterator_init \
ck_hs_next \
ck_hs_get \
@ -88,6 +90,25 @@ OBJECTS=CK_ARRAY_FOREACH \
ck_hs_reset \
ck_hs_reset_size \
ck_hs_stat \
ck_rhs_gc \
ck_rhs_init \
ck_rhs_destroy \
CK_RHS_HASH \
ck_rhs_apply \
ck_rhs_iterator_init \
ck_rhs_next \
ck_rhs_get \
ck_rhs_put \
ck_rhs_set \
ck_rhs_fas \
ck_rhs_remove \
ck_rhs_move \
ck_rhs_grow \
ck_rhs_rebuild \
ck_rhs_count \
ck_rhs_reset \
ck_rhs_reset_size \
ck_rhs_stat \
ck_rwcohort \
CK_RWCOHORT_INIT \
CK_RWCOHORT_INSTANCE \

@ -0,0 +1,61 @@
.\"
.\" Copyright 2014 David Joseph.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd August 22, 2014
.Dt CK_BITMAP_BTS 3
.Sh NAME
.Nm ck_bitmap_bts
.Nd set the bit at the specified index and fetch its original value
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_bitmap.h
.Ft bool
.Fn ck_bitmap_bts "ck_bitmap_t *bitmap" "unsigned int n"
.Sh DESCRIPTION
.Fn ck_bitmap_bts
sets the bit at the offset specified by the argument
.Fa n
to
.Dv 1
and fetches its original value.
.Sh RETURN VALUES
This function returns the original value of the bit at offset
.Fa n
in
.Fa bitmap .
.Sh SEE ALSO
.Xr ck_bitmap_base 3 ,
.Xr ck_bitmap_size 3 ,
.Xr ck_bitmap_init 3 ,
.Xr ck_bitmap_reset 3 ,
.Xr ck_bitmap_clear 3 ,
.Xr ck_bitmap_set 3 ,
.Xr ck_bitmap_test 3 ,
.Xr ck_bitmap_bits 3 ,
.Xr ck_bitmap_buffer 3
.Pp
Additional information available at http://concurrencykit.org/

@ -57,7 +57,7 @@ BOOL_LOCK_FXN refers to a method with the signature
bool(void *lock, void *context)
.Pp
The
.Fa context
.Fa context
argument in each signature is used to pass along any additional information that
the lock might need for its lock, unlock and trylock methods. The values for this
argument are provided to each call to
@ -94,7 +94,7 @@ man pages for more details.
#include <ck_cohort.h>
#include <ck_spinlock.h>
/*
/*
* Create cohort methods with signatures that match
* the required signature
*/
@ -169,7 +169,7 @@ main(void)
calloc(n_cohorts, sizeof(CK_COHORT_INSTANCE(test_cohort)));
/* create local locks to use with each cohort */
ck_spinlock_t *local_locks =
ck_spinlock_t *local_locks =
calloc(n_cohorts, sizeof(ck_spinlock_t));
pthread_t *threads =

@ -100,7 +100,7 @@ returns true, then the
.Fa UNLOCK_FUNCTION
is executed. If RTM is unsupported (no CK_F_PR_RTM macro) then
.Fn CK_ELIDE_LOCK
and
and
.Fn CK_ELIDE_LOCK_ADAPTIVE
will immediately call
.Fn LOCK_FUNCTION .
@ -118,7 +118,7 @@ Elision is attempted if the
.Fa LOCK_PREDICATE
function returns false. If
.Fa LOCK_PREDICATE
returns true or if elision fails then the
returns true or if elision fails then the
operation is aborted. If RTM is unsupported
(no CK_F_PR_RTM macro) then
.Fn CK_ELIDE_TRYLOCK

@ -46,7 +46,7 @@ function will defer the execution of the function pointed to by
until a grace-period has been detected in
.Fa epoch .
The function will be provided
the pointer specified by
the pointer specified by
.Fa entry .
The function will execute at some time in the future via calls to
.Fn ck_epoch_reclaim 3 ,

@ -52,7 +52,7 @@ is undefined if
.Fa epoch
is not a pointer to a
.Tn ck_epoch_t
object.
object.
.El
.Sh SEE ALSO
.Xr ck_epoch_register 3 ,

@ -0,0 +1,86 @@
.\"
.\" Copyright 2014 Samy Al Bahra.
.\" Copyright 2014 Backtrace I/O, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 1, 2014
.Dt CK_HS_APPLY 3
.Sh NAME
.Nm ck_hs_apply
.Nd apply a function to hash set value
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_hs.h
.Ft void *
.Fn ck_hs_apply_fn_t "void *key" "void *closure"
.Ft bool
.Fn ck_hs_apply "ck_hs_t *hs" "unsigned long hash" "const void *key" "ck_hs_apply_fn_t *function" "void *argument"
.Sh DESCRIPTION
The
.Fn ck_hs_apply 3
function will lookup the hash set slot associated with
.Fa key
and pass it to function pointed to by
.Fa function
for further action. This callback may remove or replace
the value by respectively returning NULL or a pointer to
another object with an identical key. The first argument
passed to
.Fa function
is a pointer to the object found in the hash set and
the second argument is the
.Fa argument
pointer passed to
.Fn ck_hs_apply 3 .
If the pointer returned by
.Fa function
is equivalent to the first argument then no modification
is made to the hash set.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_hs_apply 3
returns true and otherwise returns false on failure.
.Sh SEE ALSO
.Xr ck_hs_init 3 ,
.Xr ck_hs_move 3 ,
.Xr ck_hs_destroy 3 ,
.Xr ck_hs_fas 3 ,
.Xr CK_HS_HASH 3 ,
.Xr ck_hs_iterator_init 3 ,
.Xr ck_hs_next 3 ,
.Xr ck_hs_get 3 ,
.Xr ck_hs_put 3 ,
.Xr ck_hs_put_unique 3 ,
.Xr ck_hs_remove 3 ,
.Xr ck_hs_grow 3 ,
.Xr ck_hs_rebuild 3 ,
.Xr ck_hs_gc 3 ,
.Xr ck_hs_count 3 ,
.Xr ck_hs_reset 3 ,
.Xr ck_hs_reset_size 3 ,
.Xr ck_hs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -57,7 +57,7 @@ was successful then the key specified by
was successfully stored in the hash set pointed to by
.Fa hs .
The key must already exist in the hash set, and is
replaced by
replaced by
.Fa key
and the previous value is stored into the void pointer
pointed to by the
@ -75,7 +75,7 @@ Behavior is undefined if
.Fa key
or
.Fa hs
are uninitialized.
are uninitialized.
.Sh SEE ALSO
.Xr ck_hs_init 3 ,
.Xr ck_hs_move 3 ,

@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
.Sh DESCRIPTION
The
.Fn ck_hs_move 3
function will initialize
function will initialize
.Fa source
from
.Fa destination .

@ -33,7 +33,7 @@
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_hs.h
.Ft bool
.Ft bool
.Fn ck_hs_next "ck_hs_t *hs" "ck_hs_iterator_t *iterator" "void **entry"
.Sh DESCRIPTION
The

@ -57,7 +57,7 @@ was successful then the key specified by
was successfully stored in the hash set pointed to by
.Fa hs .
If the key already exists in the hash set, then it is
replaced by
replaced by
.Fa key
and the previous value is stored into the void pointer
pointed to by the

@ -38,7 +38,7 @@ ck_pr.h provides an interface to volatile atomic instructions,
memory barriers and busy-wait facilities as provided by the
underlying processor. The presence of an atomic operation
is detected by the presence of a corresponding CK_F_PR macro.
For example, the availability of
For example, the availability of
.Xr ck_pr_add_16 3
would be determined by the presence of CK_F_PR_ADD_16.
.Sh SEE ALSO
@ -56,7 +56,7 @@ would be determined by the presence of CK_F_PR_ADD_16.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_add_8 "uint8_t *target" "uint8_t delta"
.Sh DESCRIPTION
The
The
.Fn ck_pr_add 3
family of functions atomically add the value specified by
.Fa delta
@ -79,7 +79,7 @@ This family of functions does not have a return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -57,9 +57,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_and_8 "uint8_t *target" "uint8_t delta"
.Sh DESCRIPTION
The
The
.Fn ck_pr_and 3
family of functions atomically compute and store the
family of functions atomically compute and store the
result of a bitwise-and of the value pointed to by
.Fa target
and
@ -79,7 +79,7 @@ This family of functions does not have a return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -36,7 +36,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_barrier void
.Sh DESCRIPTION
The
The
.Fn ck_pr_barrier 3
function is used to disable code movement optimizations
across the invocation of the function.
@ -51,7 +51,7 @@ across the invocation of the function.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -51,13 +51,13 @@ Concurrency Kit (libck, \-lck)
.Ft bool
.Fn ck_pr_btc_16 "uint16_t *target" "unsigned int bit_index"
.Sh DESCRIPTION
The
The
.Fn ck_pr_btc 3
family of functions atomically fetch the value
of the bit in
.Fa target
at index
.Fa bit_index
.Fa bit_index
and set that bit to its complement.
.Sh RETURN VALUES
These family of functions return the original value of
@ -76,7 +76,7 @@ that is in the value pointed to by
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -51,13 +51,13 @@ Concurrency Kit (libck, \-lck)
.Ft bool
.Fn ck_pr_btr_16 "uint16_t *target" "unsigned int bit_index"
.Sh DESCRIPTION
The
The
.Fn ck_pr_btr 3
family of functions atomically fetch the value
of the bit in
.Fa target
at index
.Fa bit_index
.Fa bit_index
and set that bit to 0.
.Sh RETURN VALUES
This family of functions returns the original value of
@ -76,7 +76,7 @@ that is in the value pointed to by
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -51,13 +51,13 @@ Concurrency Kit (libck, \-lck)
.Ft bool
.Fn ck_pr_bts_16 "uint16_t *target" "unsigned int bit_index"
.Sh DESCRIPTION
The
The
.Fn ck_pr_bts 3
family of functions atomically fetch the value
of the bit in
.Fa target
at index
.Fa bit_index
.Fa bit_index
and set that bit to 1.
.Sh RETURN VALUES
This family of functions returns the original value of
@ -76,7 +76,7 @@ that is in the value pointed to by
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -99,9 +99,9 @@ Concurrency Kit (libck, \-lck)
.Ft bool
.Fn ck_pr_cas_8_value "uint8_t *target" "uint8_t old_value" "uint8_t new_value" "uint8_t *original_value"
.Sh DESCRIPTION
The
The
.Fn ck_pr_cas 3
family of functions atomically compare the value in
family of functions atomically compare the value in
.Fa target
for equality with
.Fa old_value
@ -133,7 +133,7 @@ return false.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -87,7 +87,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_dec_8_zero "uint8_t *target" "bool *z"
.Sh DESCRIPTION
The
The
.Fn ck_pr_dec 3
family of functions atomically decrement the value pointed to
by
@ -109,7 +109,7 @@ to false otherwise.
.Xr ck_pr_fas 3 ,
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft uint8_t
.Fn ck_pr_faa_8 "uint8_t *target" "uint8_t delta"
.Sh DESCRIPTION
The
The
.Fn ck_pr_faa 3
family of functions atomically fetch the value pointed to
by
@ -84,7 +84,7 @@ addition operation is applied.
.Xr ck_pr_fas 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft uint8_t
.Fn ck_pr_fas_8 "uint8_t *target" "uint8_t new_value"
.Sh DESCRIPTION
The
The
.Fn ck_pr_fas 3
family of functions atomically fetch the value pointed to
by
@ -85,7 +85,7 @@ atomically replaced with
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -57,7 +57,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -25,7 +25,7 @@
.\"
.\"
.Dd May 16, 2013
.Dt CK_PR_FENCE_ATOMIC 3
.Dt CK_PR_FENCE_ATOMIC 3
.Sh NAME
.Nm ck_pr_fence_atomic
.Nd enforce partial ordering of atomic read-modify-write operations
@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_atomic void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_atomic
function enfores the ordering of any
function enfores the ordering of any
atomic read-modify-write operations relative to
the invocation of the function. This function
always serve as an implicit compiler barrier. On
@ -96,7 +96,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -25,7 +25,7 @@
.\"
.\"
.Dd May 16, 2013
.Dt CK_PR_FENCE_ATOMIC_LOAD 3
.Dt CK_PR_FENCE_ATOMIC_LOAD 3
.Sh NAME
.Nm ck_pr_fence_atomic_load
.Nd enforce ordering of atomic read-modify-write operations to load operations
@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_atomic_load void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_atomic_load
function enfores the ordering of any
function enfores the ordering of any
atomic read-modify-write operations relative to
any load operations following the function invocation. This function
always serve as an implicit compiler barrier. On
@ -93,7 +93,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -25,7 +25,7 @@
.\"
.\"
.Dd May 16, 2013
.Dt CK_PR_FENCE_ATOMIC_STORE 3
.Dt CK_PR_FENCE_ATOMIC_STORE 3
.Sh NAME
.Nm ck_pr_fence_atomic_store
.Nd enforce ordering of atomic read-modify-write operations to store operations
@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_atomic_store void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_atomic_store
function enfores the ordering of any
function enfores the ordering of any
atomic read-modify-write operations relative to
any load operations following the function invocation. This function
always serve as an implicit compiler barrier. On
@ -94,7 +94,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -98,7 +98,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -98,7 +98,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -36,7 +36,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_load_depends void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_load_depends 3
emits necessary fences for pure data-dependent loads. It currently only serves as a compiler
barrier for Concurrency Kit's supported platforms. Unless you're on architecture
@ -60,7 +60,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -98,7 +98,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_memory
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_memory 3
function enforces the ordering of any memory operations
with respect to the invocation of the function. This function
@ -98,7 +98,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -56,7 +56,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_store void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_store
function enfores the ordering of any memory store,
.Fn ck_pr_store
@ -97,7 +97,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -38,13 +38,13 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_store_atomic void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_store_atomic
function enfores the ordering of any memory store,
.Fn ck_pr_store
and atomic read-modify-write operations to atomic read-modify-write
operations relative to the invocation of the function. This function
always serve as an implicit compiler barrier.
always serve as an implicit compiler barrier.
This functions will emit a fence for PSO and RMO
targets. In order to force the emission of a fence use the
.Fn ck_pr_fence_strict_store_atomic
@ -93,7 +93,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -38,13 +38,13 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_fence_strict_store_load void
.Sh DESCRIPTION
The
The
.Fn ck_pr_fence_store_load
function enfores the ordering of any memory store,
.Fn ck_pr_store
and atomic read-modify-write operations to load
operations relative to the invocation of the function. This function
always serve as an implicit compiler barrier.
always serve as an implicit compiler barrier.
A fence will currently always be emitted for this
operation, including for TSO memory model targets.
.Sh EXAMPLE
@ -92,7 +92,7 @@ This function has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -87,7 +87,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_inc_8_zero "uint8_t *target" "bool *z"
.Sh DESCRIPTION
The
The
.Fn ck_pr_inc 3
family of functions atomically increment the value pointed to
by
@ -109,7 +109,7 @@ false otherwise.
.Xr ck_pr_fas 3 ,
.Xr ck_pr_faa 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft uint8_t
.Fn ck_pr_load_8 "const uint8_t *target"
.Sh DESCRIPTION
The
The
.Fn ck_pr_load 3
family of functions atomically loads the value
pointed to by
@ -82,7 +82,7 @@ in the location pointed to by the first argument.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -87,7 +87,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_neg_8_zero "uint8_t *target" "bool *z"
.Sh DESCRIPTION
The
The
.Fn ck_pr_neg 3
family of functions atomically negate the value pointed to
by
@ -107,7 +107,7 @@ pointed to value to false otherwise.
.Xr ck_pr_fas 3 ,
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_not_8 "uint8_t *target"
.Sh DESCRIPTION
The
The
.Fn ck_pr_not 3
family of functions atomically complement the value pointed to
by
@ -78,7 +78,7 @@ These functions have no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -57,9 +57,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_or_8 "uint8_t *target" "uint8_t delta"
.Sh DESCRIPTION
The
The
.Fn ck_pr_or 3
family of functions atomically compute and store the
family of functions atomically compute and store the
result of a bitwise-or of the value pointed to by
.Fa target
and
@ -79,7 +79,7 @@ This family of functions does not have a return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -98,7 +98,7 @@ set manuals.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -36,9 +36,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_stall void
.Sh DESCRIPTION
The
The
.Fn ck_pr_stall 3
function should be used inside retry paths of busy-wait loops.
function should be used inside retry paths of busy-wait loops.
It not only serves as a compiler barrier, but on some architectures
it emits cycle-saving instructions.
.Sh EXAMPLE
@ -71,7 +71,7 @@ function(void)
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_store_8 "uint8_t *target" "uint8_t value"
.Sh DESCRIPTION
The
The
.Fn ck_pr_store 3
family of functions atomically stores the value specified
by
@ -82,7 +82,7 @@ This family of functions has no return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_sub 3 ,
.Xr ck_pr_and 3 ,

@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_sub_8 "uint8_t *target" "uint8_t delta"
.Sh DESCRIPTION
The
The
.Fn ck_pr_sub 3
family of functions atomically subtract the value specified by
.Fa delta
@ -79,7 +79,7 @@ This family of functions does not have a return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_and 3 ,

@ -57,9 +57,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_pr_xor_8 "uint8_t *target" "uint8_t delta"
.Sh DESCRIPTION
The
The
.Fn ck_pr_xor 3
family of functions atomically compute and store the
family of functions atomically compute and store the
result of a bitwise-xor of the value pointed to by
.Fa target
and
@ -79,7 +79,7 @@ This family of functions does not have a return value.
.Xr ck_pr_faa 3 ,
.Xr ck_pr_inc 3 ,
.Xr ck_pr_dec 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_neg 3 ,
.Xr ck_pr_not 3 ,
.Xr ck_pr_add 3 ,
.Xr ck_pr_sub 3 ,

@ -0,0 +1,86 @@
.\"
.\" Copyright 2014 Samy Al Bahra.
.\" Copyright 2014 Backtrace I/O, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 1, 2014
.Dt CK_RHS_APPLY 3
.Sh NAME
.Nm ck_rhs_apply
.Nd apply a function to hash set value
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft void *
.Fn ck_rhs_apply_fn_t "void *key" "void *closure"
.Ft bool
.Fn ck_rhs_apply "ck_rhs_t *hs" "unsigned long hash" "const void *key" "ck_rhs_apply_fn_t *function" "void *argument"
.Sh DESCRIPTION
The
.Fn ck_rhs_apply 3
function will lookup the hash set slot associated with
.Fa key
and pass it to function pointed to by
.Fa function
for further action. This callback may remove or replace
the value by respectively returning NULL or a pointer to
another object with an identical key. The first argument
passed to
.Fa function
is a pointer to the object found in the hash set and
the second argument is the
.Fa argument
pointer passed to
.Fn ck_rhs_apply 3 .
If the pointer returned by
.Fa function
is equivalent to the first argument then no modification
is made to the hash set.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_apply 3
returns true and otherwise returns false on failure.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr ck_rhs_fas 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,70 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_COUNT 3
.Sh NAME
.Nm ck_rhs_count
.Nd returns number of entries in hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft unsigned long
.Fn ck_rhs_count "ck_rhs_t *hs"
.Sh DESCRIPTION
The
.Fn ck_rhs_count 3
function returns the number of keys currently
stored in
.Fa hs .
.Sh ERRORS
Behavior is undefined if
.Fa hs
is uninitialized. Behavior is
undefined if this function is called by a non-writer
thread.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,77 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_DESTROY 3
.Sh NAME
.Nm ck_rhs_destroy
.Nd destroy hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft void
.Fn ck_rhs_destroy "ck_rhs_t *hs"
.Sh DESCRIPTION
The
.Fn ck_rhs_destroy 3
function will request that the underlying allocator, as specified by the
.Xr ck_rhs_init 3
function, immediately destroy the object pointed to by the
.Fa hs
argument.
The user must guarantee that no threads are accessing the object pointed to
by
.Fa hs
when
.Fn ck_rhs_destroy 3
is called.
.Sh RETURN VALUES
.Fn ck_rhs_destroy 3
has no return value.
.Sh ERRORS
This function is guaranteed not to fail.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,98 @@
.\"
.\" Copyright 2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd June 20, 2013
.Dt CK_RHS_FAS 3
.Sh NAME
.Nm ck_rhs_fas
.Nd fetch and store key in hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_fas "ck_rhs_t *hs" "unsigned long hash" "const void *key" "void **previous"
.Sh DESCRIPTION
The
.Fn ck_rhs_fas 3
function will fetch and store the key specified by the
.Fa key
argument in the hash set pointed to by the
.Fa hs
argument. The key specified by
.Fa key
is expected to have the hash value specified by the
.Fa hash
argument (which was previously generated using the
.Xr CK_RHS_HASH 3
macro).
.Pp
If the call to
.Fn ck_rhs_fas 3
was successful then the key specified by
.Fa key
was successfully stored in the hash set pointed to by
.Fa hs .
The key must already exist in the hash set, and is
replaced by
.Fa key
and the previous value is stored into the void pointer
pointed to by the
.Fa previous
argument. If the key does not exist in the hash set
then the function will return false and the hash set
is unchanged. This function
is guaranteed to be stable with respect to memory usage.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_fas 3
returns true and otherwise returns false on failure.
.Sh ERRORS
Behavior is undefined if
.Fa key
or
.Fa hs
are uninitialized.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,73 @@
.\"
.\" Copyright 2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd December 17, 2013
.Dt CK_RHS_GC 3
.Sh NAME
.Nm ck_rhs_gc
.Nd perform maintenance on a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_gc "ck_rhs_t *hs"
.Sh DESCRIPTION
The
.Fn ck_rhs_gc 3
function will perform various maintenance routines on the hash set
pointed to by
.Fa hs ,
including recalculating the maximum number of probes.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_gc 3
returns true and otherwise returns false on failure due to memory allocation
failure.
.Sh ERRORS
This function will only return false if there are internal memory allocation
failures.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,88 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_GET 3
.Sh NAME
.Nm ck_rhs_get
.Nd load a key from a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft void *
.Fn ck_rhs_get "ck_rhs_t *hs" "unsigned long hash" "const void *key"
.Sh DESCRIPTION
The
.Fn ck_rhs_get 3
function will return a pointer to a key in the hash set
.Fa hs
that is of equivalent value to the object pointed to by
.Fa key .
The key specified by
.Fa key
is expected to have the hash value specified by the
.Fa hash
argument (which is to have been previously generated using the
.Xr CK_RHS_HASH 3
macro).
.Sh RETURN VALUES
If the provided key is a member of
.Fa hs
then a pointer to the key as stored in
.Fa hs
is returned. If the key was not found in
.Fa hs
then a value of
.Dv NULL
is returned.
.Sh ERRORS
Behavior is undefined if
.Fa entry
or
.Fa hs
are uninitialized.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,81 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_GROW 3
.Sh NAME
.Nm ck_rhs_grow
.Nd enlarge hash set capacity
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_grow "ck_rhs_t *hs" "unsigned long capacity"
.Sh DESCRIPTION
The
.Fn ck_rhs_grow 3
function will resize the hash set in order to be
able to store at least the number of entries specified by
.Fa capacity
at a load factor of one. The default hash set load factor
is 0.5. If you wish to minimize the likelihood of memory allocations
for a hash set meant to store n entries, then specify a
.Fa capacity
of 2n. The default behavior of ck_rhs is to round
.Fa capacity
to the next power of two if it is not already a power of two.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_grow 3
returns true and otherwise returns false on failure.
.Sh ERRORS
Behavior is undefined if
.Fa hs
is uninitialized. This function will only
return false if there are internal memory allocation
failures.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,166 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_INIT 3
.Sh NAME
.Nm ck_rhs_init
.Nd initialize a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft typedef unsigned long
.Fn ck_rhs_hash_cb_t "const void *key" "unsigned long seed"
.Ft typedef bool
.Fn ck_rhs_compare_cb_t "const void *c1" "const void *c2"
.Ft bool
.Fn ck_rhs_init "ck_rhs_t *hs" "unsigned int mode" "ck_rhs_hash_cb_t *hash_function" "ck_rhs_compare_cb_t *compare" "struct ck_malloc *allocator" "unsigned long capacity" "unsigned long seed"
.Sh DESCRIPTION
The
.Fn ck_rhs_init
function initializes the hash set pointed to by the
.Fa hs
pointer.
.Pp
The argument
.Fa mode
specifies the type of key-value pairs to be stored in the
hash set as well as the expected concurrent access model.
The value of
.Fa mode
consists of a bitfield of one of the following:
.Bl -tag -width indent
.It CK_RHS_MODE_OBJECT
The hash set is meant to store pointers to objects. This provides
a hint that only CK_MD_VMA_BITS are necessary to encode the key
argument. Any unused pointer bits are leveraged for internal
optimizations.
.It CK_RHS_MODE_DIRECT
The hash set is meant to directly store key values and that all
bits of the key are used to encode values.
.It CK_RHS_MODE_READ_MOSTLY
Optimize read operations over put/delete.
.El
.Pp
The concurrent access model is specified by:
.Bl -tag -width indent
.It CK_RHS_MODE_SPMC
The hash set should allow for concurrent readers in the
presence of a single writer.
.It CK_RHS_MODE_MPMC
The hash set should allow for concurrent readers in the
presence of concurrent writers. This is currently unsupported.
.El
.Pp
The developer is free to specify additional workload hints.
These hints are one of:
.Bl -tag -width indent
.El
.Pp
The argument
.Fa hash_function
is a mandatory pointer to a user-specified hash function.
A user-specified hash function takes two arguments. The
.Fa key
argument is a pointer to a key. The
.Fa seed
argument is the initial seed associated with the hash set.
This initial seed is specified by the user in
.Xr ck_rhs_init 3 .
.Pp
The
.Fa compare
argument is an optional pointer to a user-specified
key comparison function. If NULL is specified in this
argument, then pointer equality will be used to determine
key equality. A user-specified comparison function takes
two arguments representing pointers to the objects being
compared for equality. It is expected to return true
if the keys are of equal value and false otherwise.
.Pp
The
.Fa allocator
argument is a pointer to a structure containing
.Fa malloc
and
.Fa free
function pointers which respectively define the memory allocation and
destruction functions to be used by the hash set being initialized.
.Pp
The argument
.Fa capacity
represents the initial number of keys the hash
set is expected to contain. This argument is simply a hint
and the underlying implementation is free to allocate more
or less memory than necessary to contain the number of entries
.Fa capacity
specifies.
.Pp
The argument
.Fa seed
specifies the initial seed used by the underlying hash function.
The user is free to choose a value of their choice.
.Sh RETURN VALUES
Upon successful completion
.Fn ck_rhs_init
returns a value of
.Dv true
and otherwise returns a value of
.Dv false
to indicate an error.
.Sh ERRORS
.Bl -tag -width Er
.Pp
The behavior of
.Fn ck_rhs_init
is undefined if
.Fa hs
is not a pointer to a
.Tn ck_rhs_t
object.
.El
.Sh SEE ALSO
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,78 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_ITERATOR_INIT 3
.Sh NAME
.Nm ck_rhs_iterator_init
.Nd initialize hash set iterator
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Pp
.Dv ck_rhs_iterator_t iterator = CK_RHS_ITERATOR_INITIALIZER
.Pp
.Ft void
.Fn ck_rhs_iterator_init "ck_rhs_iterator_t *iterator"
.Sh DESCRIPTION
The
.Fn ck_rhs_iterator_init 3
function will initialize the object pointed to
by the
.Fa iterator
argument. Alternatively, an iterator may be statically
initialized by assigning it to the CK_RHS_ITERATOR_INITIALIZER value.
.Pp
An iterator is used to iterate through hash set entries with the
.Xr ck_rhs_next 3
function.
.Sh RETURN VALUES
.Fn ck_rhs_iterator_init 3
has no return value.
.Sh ERRORS
This function will not fail.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,90 @@
.\"
.\" Copyright 2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd July 18, 2013
.Dt CK_RHS_MOVE 3
.Sh NAME
.Nm ck_rhs_move
.Nd move one from hash set to another
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_move "ck_rhs_t *destination" "ck_rhs_t *source" "ck_rhs_hash_cb_t *hash_cb" "ck_rhs_compare_cb_t *compare_cb" "struct ck_malloc *m"
.Sh DESCRIPTION
The
.Fn ck_rhs_move 3
function will initialize
.Fa source
from
.Fa destination .
The hash function is set to
.Fa hash_cb ,
comparison function to
.Fa compare_cb
and the allocator callbacks to
.Fa m .
Further modifications to
.Fa source
will result in undefined behavior. Concurrent
.Xr ck_rhs_get 3
and
.Xr ck_rhs_fas 3
operations to
.Fa source
are legal until the next write operation to
.Fa destination .
.Pp
This operation moves ownership from one hash set object
to another and re-assigns callback functions to developer-specified
values. This allows for dynamic configuration of allocation
callbacks and is necessary for use-cases involving executable code
which may be unmapped underneath the hash set.
.Sh RETURN VALUES
Upon successful completion
.Fn ck_rhs_move 3
returns true and otherwise returns false to indicate an error.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,92 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_NEXT 3
.Sh NAME
.Nm ck_rhs_next
.Nd iterate to next entry in hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_next "ck_rhs_t *hs" "ck_rhs_iterator_t *iterator" "void **entry"
.Sh DESCRIPTION
The
.Fn ck_rhs_next 3
function will increment the iterator object pointed to by
.Fa iterator
to point to the next non-empty hash set entry. If
.Fn ck_rhs_next 3
returns true then the pointer pointed to by
.Fa entry
is initialized to the current hash set key pointed to by the
.Fa iterator
object.
.Pp
It is expected that
.Fa iterator
has been initialized using the
.Xr ck_rhs_iterator_init 3
function or statically initialized using CK_RHS_ITERATOR_INITIALIZER.
.Sh RETURN VALUES
If
.Fn ck_rhs_next 3
returns true then the object pointed to by
.Fa entry
points to a valid hash set key. If
.Fn ck_rhs_next 3
returns false then the value of the object pointed to by
.Fa entry
is undefined.
.Sh ERRORS
Behavior is undefined if
.Fa iterator
or
.Fa hs
are uninitialized.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,98 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_PUT 3
.Sh NAME
.Nm ck_rhs_put
.Nd store unique key into a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_put "ck_rhs_t *hs" "unsigned long hash" "const void *key"
.Sh DESCRIPTION
The
.Fn ck_rhs_put 3
function will store the key specified by the
.Fa key
argument in the hash set pointed to by the
.Fa hs
argument. The key specified by
.Fa key
is expected to have the hash value specified by the
.Fa hash
argument (which was previously generated using the
.Xr CK_RHS_HASH 3
macro).
.Pp
If the call to
.Fn ck_rhs_put 3
was successful then the key specified by
.Fa key
was successfully stored in the hash set pointed to by
.Fa hs .
The function will fail if a key with an
equivalent value to
.Fa key
is already present in the hash set. For replacement
semantics, please see the
.Xr ck_rhs_set 3
function.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_put 3
returns true and otherwise returns false on failure.
.Sh ERRORS
Behavior is undefined if
.Fa key
or
.Fa hs
are uninitialized. The function will also
return false if the hash set could not be enlarged
to accomodate key insertion.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,98 @@
.\"
.\" Copyright 2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd December 7, 2013
.Dt CK_RHS_PUT_UNIQUE 3
.Sh NAME
.Nm ck_rhs_put_unique
.Nd unconditionally store unique key into a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_put_unique "ck_rhs_t *hs" "unsigned long hash" "const void *key"
.Sh DESCRIPTION
The
.Fn ck_rhs_put_unique 3
function will store the key specified by the
.Fa key
argument in the hash set pointed to by the
.Fa hs
argument. The key specified by
.Fa key
is expected to have the hash value specified by the
.Fa hash
argument (which was previously generated using the
.Xr CK_RHS_HASH 3
macro).
.Pp
If the call to
.Fn ck_rhs_put 3
was successful then the key specified by
.Fa key
was successfully stored in the hash set pointed to by
.Fa hs .
The function will cause undefined behavior if a key with an
equivalent value is already present in the hash set. For replacement
semantics, please see the
.Xr ck_rhs_set 3
function.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_put_unique 3
returns true and otherwise returns false on failure.
.Sh ERRORS
Behavior is undefined if
.Fa key
or
.Fa hs
are uninitialized. The function will also
return false if the hash set could not be enlarged
to accomodate key insertion. The function will
result in undefined behavior if called for an
already inserted key value.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,76 @@
.\"
.\" Copyright 2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd December 7, 2013
.Dt CK_RHS_REBUILD 3
.Sh NAME
.Nm ck_rhs_rebuild
.Nd rebuild a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_rebuild "ck_rhs_t *hs"
.Sh DESCRIPTION
The
.Fn ck_rhs_rebuild 3
function will regenerate the hash set pointed to by
.Fa hs .
This has the side-effect of pruning degradatory side-effects
of workloads that are delete heavy. The regenerated hash
set should have shorter probe sequences on average. This
operation will require a significant amount of memory
and is free to allocate a duplicate hash set in the
rebuild process.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_rebuild 3
returns true and otherwise returns false on failure.
.Sh ERRORS
This function will only return false if there are internal memory allocation
failures.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,92 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_REMOVE 3
.Sh NAME
.Nm ck_rhs_remove
.Nd remove key from a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft void *
.Fn ck_rhs_remove "ck_rhs_t *hs" "unsigned long hash" "const void *key"
.Sh DESCRIPTION
The
.Fn ck_rhs_remove 3
function will attempt to remove the key specified by the
.Fa key
argument in the hash set pointed to by the
.Fa hs
argument. The key specified by
.Fa key
is expected to have the hash value specified by the
.Fa hash
argument (which was previously generated using the
.Xr CK_RHS_HASH 3
macro).
.Pp
If the call to
.Fn ck_rhs_remove 3
was successful then the key contained in the hash
set is returned. If the key was not a member of the hash
set then
.Dv NULL
is returned.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_remove 3
returns a pointer to a key and otherwise returns
.Dv NULL
on failure.
.Sh ERRORS
Behavior is undefined if
.Fa key
or
.Fa hs
are uninitialized.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,77 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_RESET 3
.Sh NAME
.Nm ck_rhs_reset
.Nd remove all keys from a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_reset "ck_rhs_t *hs"
.Sh DESCRIPTION
The
.Fn ck_rhs_reset 3
function will remove all keys stored in the hash
set pointed to by the
.Fa hs
argument.
.Sh RETURN VALUES
If successful,
.Fn ck_rhs_reset 3
will return true and will otherwise return false on failure. This
function will only fail if a replacement hash set could not be
allocated internally.
.Sh ERRORS
Behavior is undefined if
.Fa hs
is uninitialized. Behavior is
undefined if this function is called by a non-writer
thread.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,80 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd May 5, 2013
.Dt CK_RHS_RESET_SIZE 3
.Sh NAME
.Nm ck_rhs_reset_size
.Nd remove all keys from a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_reset_size "ck_rhs_t *hs" "unsigned long size"
.Sh DESCRIPTION
The
.Fn ck_rhs_reset_size 3
function will remove all keys stored in the hash
set pointed to by the
.Fa hs
argument and create a new generation of the hash set that
is preallocated for
.Fa size
entries.
.Sh RETURN VALUES
If successful,
.Fn ck_rhs_reset_size 3
will return true and will otherwise return false on failure. This
function will only fail if a replacement hash set could not be
allocated internally.
.Sh ERRORS
Behavior is undefined if
.Fa hs
is uninitialized. Behavior is
undefined if this function is called by a non-writer
thread.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,102 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_SET 3
.Sh NAME
.Nm ck_rhs_set
.Nd store key into a hash set
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft bool
.Fn ck_rhs_set "ck_rhs_t *hs" "unsigned long hash" "const void *key" "void **previous"
.Sh DESCRIPTION
The
.Fn ck_rhs_set 3
function will store the key specified by the
.Fa key
argument in the hash set pointed to by the
.Fa hs
argument. The key specified by
.Fa key
is expected to have the hash value specified by the
.Fa hash
argument (which was previously generated using the
.Xr CK_RHS_HASH 3
macro).
.Pp
If the call to
.Fn ck_rhs_set 3
was successful then the key specified by
.Fa key
was successfully stored in the hash set pointed to by
.Fa hs .
If the key already exists in the hash set, then it is
replaced by
.Fa key
and the previous value is stored into the void pointer
pointed to by the
.Fa previous
argument. If previous is set to
.Dv NULL
then
.Fa key
was not a replacement for an existing entry in the hash set.
.Sh RETURN VALUES
Upon successful completion,
.Fn ck_rhs_set 3
returns true and otherwise returns false on failure.
.Sh ERRORS
Behavior is undefined if
.Fa key
or
.Fa hs
are uninitialized. The function will also
return false if the hash set could not be enlarged
to accomodate key insertion.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3 ,
.Xr ck_rhs_stat 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,80 @@
.\"
.\" Copyright 2012-2013 Samy Al Bahra.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd September 17, 2012
.Dt CK_RHS_STAT 3
.Sh NAME
.Nm ck_rhs_stat
.Nd get hash set status
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_rhs.h
.Ft void
.Fn ck_rhs_stat "ck_rhs_t *hs" "struct ck_rhs_stat *st"
.Sh DESCRIPTION
The
.Fn ck_rhs_stat 3
function will store various hash set statistics in
the object pointed to by
.Fa st .
The ck_rhs_stat structure is defined as follows:
.Bd -literal -offset indent
struct ck_rhs_stat {
unsigned long n_entries; /* Current number of keys in hash set. */
unsigned int probe_maximum; /* Longest read-side probe sequence. */
};
.Ed
.Sh RETURN VALUES
.Fn ck_rhs_stat 3
has no return value.
.Sh ERRORS
Behavior is undefined if
.Fa hs
is uninitialized. Behavior is
undefined if this function is called by a non-writer
thread.
.Sh SEE ALSO
.Xr ck_rhs_init 3 ,
.Xr ck_rhs_move 3 ,
.Xr ck_rhs_destroy 3 ,
.Xr CK_RHS_HASH 3 ,
.Xr ck_rhs_iterator_init 3 ,
.Xr ck_rhs_next 3 ,
.Xr ck_rhs_get 3 ,
.Xr ck_rhs_put 3 ,
.Xr ck_rhs_put_unique 3 ,
.Xr ck_rhs_set 3 ,
.Xr ck_rhs_fas 3 ,
.Xr ck_rhs_remove 3 ,
.Xr ck_rhs_grow 3 ,
.Xr ck_rhs_gc 3 ,
.Xr ck_rhs_rebuild 3 ,
.Xr ck_rhs_count 3 ,
.Xr ck_rhs_reset 3 ,
.Xr ck_rhs_reset_size 3
.Pp
Additional information available at http://concurrencykit.org/

@ -91,7 +91,7 @@ dequeue(void)
}
/* An empty ring was encountered, leave. */
return;
return;
}
.Ed
.Sh RETURN VALUES

@ -89,7 +89,7 @@ dequeue(void)
}
/* An empty ring was encountered, leave. */
return;
return;
}
.Ed
.Sh RETURN VALUES

@ -42,7 +42,7 @@ function enqueues the pointer
.Fa entry
into the bounded buffer pointed to by
.Fa ring
in FIFO fashion.
in FIFO fashion.
The buffer pointed to by
.Fa buffer
must be unique to
@ -88,11 +88,11 @@ enqueue(void)
}
/* Enqueue operation completed successfully. */
return;
return;
}
.Ed
.Sh RETURN VALUES
The function returns true if the value of
The function returns true if the value of
.Fa entry
was successfully enqueued into
.Fa ring .

@ -42,7 +42,7 @@ function enqueues the pointer
.Fa entry
into the bounded buffer pointed to by
.Fa ring
in FIFO fashion.
in FIFO fashion.
The buffer pointed to by
.Fa buffer
must be unique to
@ -96,11 +96,11 @@ enqueue(void)
do_something;
}
return;
return;
}
.Ed
.Sh RETURN VALUES
The function returns true if the value of
The function returns true if the value of
.Fa entry
was successfully enqueued into
.Fa ring .

@ -42,7 +42,7 @@ function enqueues the pointer
.Fa entry
into the bounded buffer pointed to by
.Fa ring
in FIFO fashion.
in FIFO fashion.
The buffer pointed to by
.Fa buffer
must be unique to
@ -86,11 +86,11 @@ enqueue(void)
}
/* Enqueue operation completed successfully. */
return;
return;
}
.Ed
.Sh RETURN VALUES
The function returns true if the value of
The function returns true if the value of
.Fa entry
was successfully enqueued into
.Fa ring .

@ -42,7 +42,7 @@ function enqueues the pointer
.Fa entry
into the bounded buffer pointed to by
.Fa ring
in FIFO fashion.
in FIFO fashion.
The buffer pointed to by
.Fa buffer
must be unique to
@ -94,11 +94,11 @@ enqueue(void)
do_something;
}
return;
return;
}
.Ed
.Sh RETURN VALUES
The function returns true if the value of
The function returns true if the value of
.Fa entry
was successfully enqueued into
.Fa ring .

@ -71,7 +71,7 @@ in a bounded number of steps. It is
possible for the function to return false even
if
.Fa ring
is non-empty. This
is non-empty. This
.Sh EXAMPLE
.Bd -literal -offset indent
#include <ck_ring.h>
@ -97,7 +97,7 @@ dequeue(void)
}
/* An empty ring was encountered, leave. */
return;
return;
}
.Ed
.Sh RETURN VALUES

@ -69,7 +69,7 @@ either the
.Xr CK_COHORT_PROTOTYPE 3
or the
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
macros, and define a reader-writer lock type using the
macros, and define a reader-writer lock type using the
.Xr CK_RWCOHORT_PROTOTYPE 3
macro.
.Pp
@ -161,7 +161,7 @@ main(void)
calloc(n_cohorts, sizeof(CK_COHORT_INSTANCE(test_cohort)));
/* create local locks to use with each cohort */
ck_spinlock_t *local_locks =
ck_spinlock_t *local_locks =
calloc(n_cohorts, sizeof(ck_spinlock_t));
pthread_t *threads =

@ -43,9 +43,9 @@ Concurrency Kit (libck, \-lck)
.Ft void
.Fn ck_sequence_init "ck_sequence_t *sq"
.Ft unsigned int
.Fn ck_sequence_read_begin "ck_sequence_t *sq"
.Fn ck_sequence_read_begin "const ck_sequence_t *sq"
.Ft bool
.Fn ck_sequence_read_retry "ck_sequence_t *sq" "unsigned int version"
.Fn ck_sequence_read_retry "const ck_sequence_t *sq" "unsigned int version"
.Ft void
.Fn ck_sequence_write_begin "ck_sequence_t *sq"
.Ft void

@ -200,7 +200,7 @@ provides a summary of the current implementations.
ck_spinlock_ticket Ticket Centralized None Yes
.Ed
.Pp
* Hierarchical CLH only offers weak fairness for threads accross cluster
* Hierarchical CLH only offers weak fairness for threads accross cluster
nodes.
.Pp
If contention is low and there is no hard requirement for starvation-freedom

@ -98,4 +98,3 @@ ck_array_initialized(struct ck_array *array)
_ck_i++)
#endif /* _CK_ARRAY_H */

@ -28,6 +28,7 @@
#define _CK_BACKOFF_H
#include <ck_cc.h>
#include <ck_pr.h>
#ifndef CK_BACKOFF_CEILING
#define CK_BACKOFF_CEILING ((1 << 20) - 1)
@ -35,24 +36,22 @@
#define CK_BACKOFF_INITIALIZER (1 << 9)
typedef volatile unsigned int ck_backoff_t;
typedef unsigned int ck_backoff_t;
/*
* This is a exponential back-off implementation.
*/
CK_CC_INLINE static void
ck_backoff_eb(volatile unsigned int *c)
ck_backoff_eb(unsigned int *c)
{
volatile unsigned int i;
unsigned int ceiling;
unsigned int i, ceiling;
ceiling = *c;
for (i = 0; i < ceiling; i++);
for (i = 0; i < ceiling; i++)
ck_pr_barrier();
*c = ceiling <<= ceiling < CK_BACKOFF_CEILING;
return;
}
#endif /* _CK_BACKOFF_H */

@ -162,4 +162,3 @@ void ck_barrier_mcs_subscribe(ck_barrier_mcs_t *, ck_barrier_mcs_state_t *);
void ck_barrier_mcs(ck_barrier_mcs_t *, ck_barrier_mcs_state_t *);
#endif /* _CK_BARRIER_H */

@ -44,6 +44,7 @@
#endif
#define CK_BITMAP_BLOCK (sizeof(unsigned int) * CHAR_BIT)
#define CK_BITMAP_OFFSET(i) ((i) % CK_BITMAP_BLOCK)
#define CK_BITMAP_BIT(i) (1U << ((i) % CK_BITMAP_BLOCK))
#define CK_BITMAP_PTR(x, i) ((x) + ((i) / CK_BITMAP_BLOCK))
#define CK_BITMAP_BLOCKS(n) (((n) + CK_BITMAP_BLOCK - 1) / CK_BITMAP_BLOCK)
@ -69,6 +70,9 @@
#define CK_BITMAP_SET(a, b) \
ck_bitmap_set(&(a)->bitmap, (b))
#define CK_BITMAP_BTS(a, b) \
ck_bitmap_bts(&(a)->bitmap, (b))
#define CK_BITMAP_RESET(a, b) \
ck_bitmap_reset(&(a)->bitmap, (b))
@ -171,6 +175,20 @@ ck_bitmap_set(struct ck_bitmap *bitmap, unsigned int n)
return;
}
/*
* Performs a test-and-set operation at the offset specified in the
* second argument.
* Returns true if the bit at the specified offset was already set,
* false otherwise.
*/
CK_CC_INLINE static bool
ck_bitmap_bts(struct ck_bitmap *bitmap, unsigned int n)
{
return ck_pr_bts_uint(CK_BITMAP_PTR(bitmap->map, n),
CK_BITMAP_OFFSET(n));
}
/*
* Resets the bit at the offset specified in the second argument.
*/
@ -251,7 +269,8 @@ ck_bitmap_intersection(struct ck_bitmap *dst, const struct ck_bitmap *src)
* complete bitmap. Any trailing bit in dst is left as is.
*/
CK_CC_INLINE static void
ck_bitmap_intersection_negate(struct ck_bitmap *dst, const struct ck_bitmap *src)
ck_bitmap_intersection_negate(struct ck_bitmap *dst,
const struct ck_bitmap *src)
{
unsigned int n;
unsigned int n_intersect = dst->n_bits;
@ -275,8 +294,9 @@ ck_bitmap_intersection_negate(struct ck_bitmap *dst, const struct ck_bitmap *src
CK_CC_INLINE static void
ck_bitmap_clear(struct ck_bitmap *bitmap)
{
unsigned int n_buckets = ck_bitmap_base(bitmap->n_bits) / sizeof(unsigned int);
unsigned int i;
unsigned int n_buckets = ck_bitmap_base(bitmap->n_bits) /
sizeof(unsigned int);
for (i = 0; i < n_buckets; i++)
ck_pr_store_uint(&bitmap->map[i], 0);
@ -379,7 +399,8 @@ ck_bitmap_count(const ck_bitmap_t *bitmap, unsigned int limit)
* size, it is truncated to the smallest.
*/
CK_CC_INLINE static unsigned int
ck_bitmap_count_intersect(const ck_bitmap_t *x, const ck_bitmap_t *y, unsigned int limit)
ck_bitmap_count_intersect(const ck_bitmap_t *x, const ck_bitmap_t *y,
unsigned int limit)
{
unsigned int count, i, slop, words;
@ -441,7 +462,8 @@ ck_bitmap_init(struct ck_bitmap *bitmap,
* Initialize iterator for use with provided bitmap.
*/
CK_CC_INLINE static void
ck_bitmap_iterator_init(struct ck_bitmap_iterator *i, const struct ck_bitmap *bitmap)
ck_bitmap_iterator_init(struct ck_bitmap_iterator *i,
const struct ck_bitmap *bitmap)
{
i->n_block = 0;

@ -277,4 +277,3 @@ ck_brlock_read_unlock(struct ck_brlock_reader *reader)
}
#endif /* _CK_BRLOCK_H */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save