Import concurrencykit as of commit 566bb28dba963a1904e0889b74fe7005a5bc5eb8
This commit is contained in:
commit
85bd1e2d0a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/ck/dist/; revision=309260
54
LICENSE
Normal file
54
LICENSE
Normal file
@ -0,0 +1,54 @@
|
||||
Copyright 2010-2014 Samy Al Bahra.
|
||||
Copyright 2011-2013 AppNexus, 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 AUTHOR 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 AUTHOR 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.
|
||||
|
||||
Hazard Pointers (src/ck_hp.c) also includes this license:
|
||||
|
||||
(c) Copyright 2008, IBM Corporation.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
ck_pr_rtm leverages work from Andi Kleen:
|
||||
Copyright (c) 2012,2013 Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that: (1) source code distributions
|
||||
retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
distributions including binary code include the above copyright notice and
|
||||
this paragraph in its entirety in the documentation or other materials
|
||||
provided with the distribution
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
103
Makefile.in
Normal file
103
Makefile.in
Normal file
@ -0,0 +1,103 @@
|
||||
.PHONY: all check clean dist distclean doc install install-headers regressions uninstall
|
||||
|
||||
BUILD_DIR=@BUILD_DIR@
|
||||
SRC_DIR=@SRC_DIR@
|
||||
CFLAGS=@CFLAGS@
|
||||
VERSION=@VERSION@
|
||||
VERSION_MAJOR=@VERSION_MAJOR@
|
||||
PREFIX=@PREFIX@
|
||||
LIBRARY=@LIBRARY@
|
||||
HEADERS=@HEADERS@
|
||||
PKGCONFIG_DATA=@LIBRARY@/pkgconfig
|
||||
LDNAME=@LDNAME@
|
||||
LDNAME_VERSION=@LDNAME_VERSION@
|
||||
LDNAME_MAJOR=@LDNAME_MAJOR@
|
||||
|
||||
all: doc
|
||||
$(MAKE) -C src all || exit
|
||||
@echo
|
||||
@echo
|
||||
@echo ---[ Concurrency Kit has built successfully. You may now \"make install\".
|
||||
|
||||
doc:
|
||||
$(MAKE) -C doc all || exit
|
||||
@echo ---[ Manual pages are ready for installation.
|
||||
|
||||
regressions:
|
||||
$(MAKE) -C regressions all || exit
|
||||
@echo ---[ Regressions have built successfully.
|
||||
|
||||
check: regressions
|
||||
@echo ---[ Executing unit tests...
|
||||
$(MAKE) -C regressions check
|
||||
@echo ---[ Unit tests have completed successfully.
|
||||
|
||||
install-headers:
|
||||
mkdir -p $(DESTDIR)/$(HEADERS) || exit
|
||||
cp $(SRC_DIR)/include/*.h $(DESTDIR)/$(HEADERS) || exit
|
||||
chmod 644 $(DESTDIR)/$(HEADERS)/ck_*.h || exit
|
||||
mkdir -p $(DESTDIR)$(HEADERS)/gcc || exit
|
||||
cp -r $(SRC_DIR)/include/gcc/* $(DESTDIR)/$(HEADERS)/gcc || exit
|
||||
cp include/ck_md.h $(DESTDIR)/$(HEADERS)/ck_md.h || exit
|
||||
chmod 755 $(DESTDIR)/$(HEADERS)/gcc
|
||||
chmod 644 $(DESTDIR)/$(HEADERS)/gcc/ck_*.h $(DESTDIR)/$(HEADERS)/gcc/*/ck_*.h || exit
|
||||
mkdir -p $(DESTDIR)$(HEADERS)/spinlock || exit
|
||||
cp -r $(SRC_DIR)/include/spinlock/* $(DESTDIR)/$(HEADERS)/spinlock || exit
|
||||
chmod 755 $(DESTDIR)/$(HEADERS)/spinlock
|
||||
chmod 644 $(DESTDIR)/$(HEADERS)/spinlock/*.h || exit
|
||||
|
||||
install-so:
|
||||
mkdir -p $(DESTDIR)/$(LIBRARY)
|
||||
cp src/libck.so $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION)
|
||||
ln -sf $(LDNAME_VERSION) $(DESTDIR)/$(LIBRARY)/$(LDNAME)
|
||||
ln -sf $(LDNAME_VERSION) $(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR)
|
||||
chmod 744 $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) \
|
||||
$(DESTDIR)/$(LIBRARY)/$(LDNAME) \
|
||||
$(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR)
|
||||
|
||||
install-lib:
|
||||
mkdir -p $(DESTDIR)/$(LIBRARY)
|
||||
cp src/libck.a $(DESTDIR)/$(LIBRARY)/libck.a
|
||||
chmod 644 $(DESTDIR)/$(LIBRARY)/libck.a
|
||||
|
||||
install: all install-headers @INSTALL_LIBS@
|
||||
$(MAKE) -C doc install
|
||||
mkdir -p $(DESTDIR)/$(LIBRARY) || exit
|
||||
mkdir -p $(DESTDIR)/$(PKGCONFIG_DATA) || exit
|
||||
chmod 755 $(DESTDIR)/$(PKGCONFIG_DATA)
|
||||
cp build/ck.pc $(DESTDIR)/$(PKGCONFIG_DATA)/ck.pc || exit
|
||||
@echo
|
||||
@echo
|
||||
@echo ---[ Concurrency Kit has installed successfully.
|
||||
|
||||
uninstall:
|
||||
$(MAKE) -C doc uninstall
|
||||
rm -f $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) \
|
||||
$(DESTDIR)/$(LIBRARY)/$(LDNAME) \
|
||||
$(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR)
|
||||
rm -f $(DESTDIR)/$(LIBRARY)/libck.so*
|
||||
rm -f $(DESTDIR)/$(LIBRARY)/libck.a
|
||||
rm -f $(DESTDIR)/$(HEADERS)/ck_*.h
|
||||
rm -f $(DESTDIR)/$(HEADERS)/spinlock/*.h
|
||||
rm -f $(DESTDIR)/$(HEADERS)/gcc/ck_*.h
|
||||
rm -f $(DESTDIR)/$(HEADERS)/gcc/*/ck_*.h
|
||||
rm -f $(DESTDIR)/$(PKGCONFIG_DATA)/ck.pc
|
||||
|
||||
clean:
|
||||
$(MAKE) -C doc clean
|
||||
$(MAKE) -C src clean
|
||||
$(MAKE) -C regressions clean
|
||||
rm -f $(BUILD_DIR)/*~ $(BUILD_DIR)/*.o $(BUILD_DIR)/*.tar.gz
|
||||
|
||||
dist:
|
||||
git archive --remote=$(SRC_DIR) --format=tar --prefix=ck-$(VERSION)/ HEAD \
|
||||
| gzip > $(BUILD_DIR)/ck-$(VERSION).tar.gz
|
||||
|
||||
distclean: clean
|
||||
rm -f $(BUILD_DIR)/include/ck_md.h
|
||||
rm -f $(BUILD_DIR)/build/regressions.build
|
||||
rm -f $(BUILD_DIR)/build/ck.build
|
||||
rm -f $(BUILD_DIR)/build/ck.pc
|
||||
rm -f $(BUILD_DIR)/Makefile
|
||||
rm -f $(BUILD_DIR)/doc/Makefile
|
||||
|
21
README
Normal file
21
README
Normal file
@ -0,0 +1,21 @@
|
||||
____ _ ___ _
|
||||
/ ___|___ _ __ ___ _ _ _ __ _ __ ___ _ __ ___ _ _ | |/ (_) |_
|
||||
| | / _ \| '_ \ / __| | | | '__| '__/ _ \ '_ \ / __| | | | | ' /| | __|
|
||||
| |__| (_) | | | | (__| |_| | | | | | __/ | | | (__| |_| | | . \| | |_
|
||||
\____\___/|_| |_|\___|\__,_|_| |_| \___|_| |_|\___|\__, | |_|\_\_|\__|
|
||||
|___/
|
||||
|
||||
Step 1.
|
||||
./configure
|
||||
For additional options try ./configure --help
|
||||
|
||||
Step 2.
|
||||
In order to compile regressions (requires POSIX threads) use
|
||||
"make regressions". In order to compile libck use "make all" or "make".
|
||||
|
||||
Step 3.
|
||||
In order to install use "make install"
|
||||
To uninstall use "make uninstall".
|
||||
|
||||
See http://concurrencykit.org/ for more information.
|
||||
|
1
build/ck.build.aarch64
Normal file
1
build/ck.build.aarch64
Normal file
@ -0,0 +1 @@
|
||||
|
1
build/ck.build.arm
Normal file
1
build/ck.build.arm
Normal file
@ -0,0 +1 @@
|
||||
CFLAGS+=-D__arm__
|
10
build/ck.build.in
Normal file
10
build/ck.build.in
Normal file
@ -0,0 +1,10 @@
|
||||
CC=@CC@
|
||||
MAKE=make
|
||||
SRC_DIR=@SRC_DIR@
|
||||
BUILD_DIR=@BUILD_DIR@
|
||||
CFLAGS+=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include
|
||||
LDFLAGS+=@LDFLAGS@
|
||||
ALL_LIBS=@ALL_LIBS@
|
||||
LD=@LD@
|
||||
|
||||
include $(BUILD_DIR)/build/ck.build.@PROFILE@
|
1
build/ck.build.ppc
Normal file
1
build/ck.build.ppc
Normal file
@ -0,0 +1 @@
|
||||
CFLAGS+=-m32 -D__ppc__
|
2
build/ck.build.ppc64
Normal file
2
build/ck.build.ppc64
Normal file
@ -0,0 +1,2 @@
|
||||
CFLAGS+=-m64 -D__ppc64__
|
||||
LDFLAGS+=-m64
|
1
build/ck.build.sparcv9
Normal file
1
build/ck.build.sparcv9
Normal file
@ -0,0 +1 @@
|
||||
CFLAGS+=-m64 -D__sparcv9__
|
2
build/ck.build.x86
Normal file
2
build/ck.build.x86
Normal file
@ -0,0 +1,2 @@
|
||||
CFLAGS+=-m32 -D__x86__ -msse -msse2
|
||||
LDFLAGS+=-m32
|
2
build/ck.build.x86_64
Normal file
2
build/ck.build.x86_64
Normal file
@ -0,0 +1,2 @@
|
||||
CFLAGS+=-m64 -D__x86_64__
|
||||
LDFLAGS+=-m64
|
10
build/ck.pc.in
Normal file
10
build/ck.pc.in
Normal file
@ -0,0 +1,10 @@
|
||||
prefix=@PREFIX@
|
||||
includedir=@HEADERS@
|
||||
libdir=@LIBRARY@
|
||||
|
||||
Name: Concurrency Kit
|
||||
Description: Toolkit for well-specified design and implementation of concurrent systems
|
||||
URL: http://concurrencykit.org/
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lck
|
||||
Cflags: -D__@PROFILE@__ -I${includedir} @PC_CFLAGS@
|
74
build/ck.spec.in
Normal file
74
build/ck.spec.in
Normal file
@ -0,0 +1,74 @@
|
||||
Name: ck
|
||||
Version: @VERSION@
|
||||
Release: 1%{?dist}
|
||||
Group: Development/Libraries
|
||||
Summary: Concurrency Kit
|
||||
License: Simplified BSD License
|
||||
URL: http://concurrencykit.org
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
Source: http://concurrencykit.org/releases/ck-%{version}.tar.gz
|
||||
|
||||
%description
|
||||
Concurrency Kit provides a plethora of concurrency primitives, safe memory
|
||||
reclamation mechanisms and lock-less and lock-free data structures designed to
|
||||
aid in the design and implementation of high performance concurrent systems. It
|
||||
is designed to minimize dependencies on operating system-specific interfaces
|
||||
and most of the interface relies only on a strict subset of the standard
|
||||
library and more popular compiler extensions.
|
||||
|
||||
%package devel
|
||||
Group: Development/Libraries
|
||||
Summary: Header files and libraries for CK development
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
Concurrency Kit provides a plethora of concurrency primitives, safe memory
|
||||
reclamation mechanisms and lock-less and lock-free data structures designed to
|
||||
aid in the design and implementation of high performance concurrent systems. It
|
||||
is designed to minimize dependencies on operating system-specific interfaces
|
||||
and most of the interface relies only on a strict subset of the standard
|
||||
library and more popular compiler extensions.
|
||||
|
||||
This package provides the libraries, include files, and other
|
||||
resources needed for developing Concurrency Kit applications.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
CFLAGS=$RPM_OPT_FLAGS ./configure \
|
||||
--libdir=%{_libdir} \
|
||||
--includedir=%{_includedir}/%{name} \
|
||||
--mandir=%{_mandir} \
|
||||
--prefix=%{_prefix}
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_libdir}/libck.so.@VERSION@
|
||||
%{_libdir}/libck.so.@VERSION_MAJOR@
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libck.so
|
||||
%{_includedir}/%{name}/*.h
|
||||
%{_includedir}/%{name}/*/*.h
|
||||
%{_includedir}/%{name}/*/*/*.h
|
||||
%{_libdir}/libck.a
|
||||
%{_libdir}/pkgconfig/%{name}.pc
|
||||
%{_mandir}/man3/*.3.gz
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
|
10
build/regressions.build.in
Normal file
10
build/regressions.build.in
Normal file
@ -0,0 +1,10 @@
|
||||
CC=@CC@
|
||||
MAKE=make
|
||||
CORES=@CORES@
|
||||
CFLAGS=@CFLAGS@ -I../../../include -DCORES=@CORES@
|
||||
LD=@LD@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
|
||||
BUILD_DIR=@BUILD_DIR@
|
||||
|
||||
include $(BUILD_DIR)/build/ck.build.@PROFILE@
|
775
configure
vendored
Executable file
775
configure
vendored
Executable file
@ -0,0 +1,775 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright © 2009-2013 Samy Al Bahra.
|
||||
# Copyright © 2011 Devon H. O'Dell <devon.odell@gmail.com>
|
||||
# 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 AUTHOR 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 AUTHOR 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.
|
||||
#
|
||||
|
||||
REQUIRE_HEADER="stdbool.h stddef.h stdint.h string.h"
|
||||
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_FAILURE=1
|
||||
WANT_PIC=yes
|
||||
|
||||
P_PWD=`pwd`
|
||||
MAINTAINER='sbahra@repnop.org'
|
||||
VERSION=${VERSION:-'0.5.2'}
|
||||
VERSION_MAJOR='0'
|
||||
BUILD="$PWD/build/ck.build"
|
||||
PREFIX=${PREFIX:-"/usr/local"}
|
||||
LDNAME="libck.so"
|
||||
LDNAME_VERSION="libck.so.$VERSION"
|
||||
LDNAME_MAJOR="libck.so.$VERSION_MAJOR"
|
||||
|
||||
OPTION_CHECKING=1
|
||||
|
||||
export CFLAGS
|
||||
export PREFIX
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
if test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
|
||||
set -o posix
|
||||
fi
|
||||
|
||||
trap epilog 1 2 3 6
|
||||
|
||||
epilog()
|
||||
{
|
||||
rm -f .1.c .1
|
||||
}
|
||||
|
||||
assert()
|
||||
{
|
||||
|
||||
if test "$#" -eq 2; then
|
||||
fail=$2
|
||||
print=true
|
||||
elif test "$#" -eq 3; then
|
||||
fail=$3
|
||||
print=echo
|
||||
else
|
||||
echo "Usage: assert <test> <fail string> or assert <test> <success string> <fail string>" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
if test -z "$1"; then
|
||||
echo "failed [$fail]"
|
||||
exit $EXIT_FAILURE
|
||||
else
|
||||
${print} "success [$1]"
|
||||
fi
|
||||
}
|
||||
|
||||
get_git_sha()
|
||||
{
|
||||
# return a short SHA for the current HEAD
|
||||
GIT_SHA=""
|
||||
GIT_MSG="success"
|
||||
gitcmd=`which git`
|
||||
if test -n "$gitcmd"; then
|
||||
GIT_SHA=`git rev-parse --short HEAD 2>/dev/null`
|
||||
if ! test -n "$GIT_SHA"; then
|
||||
GIT_MSG="not within a git repo"
|
||||
fi
|
||||
else
|
||||
GIT_MSG="git not installed or executable"
|
||||
fi
|
||||
}
|
||||
|
||||
generate()
|
||||
{
|
||||
sed -e "s#@PROFILE@#$PROFILE#g" \
|
||||
-e "s#@VERSION@#$VERSION#g" \
|
||||
-e "s#@VERSION_MAJOR@#$VERSION_MAJOR#g" \
|
||||
-e "s#@CC@#$CC#g" \
|
||||
-e "s#@CFLAGS@#$CFLAGS#g" \
|
||||
-e "s#@HEADERS@#$HEADERS#g" \
|
||||
-e "s#@LIBRARY@#$LIBRARY#g" \
|
||||
-e "s#@PREFIX@#$PREFIX#g" \
|
||||
-e "s#@CORES@#$CORES#g" \
|
||||
-e "s#@ALL_LIBS@#$ALL_LIBS#g" \
|
||||
-e "s#@INSTALL_LIBS@#$INSTALL_LIBS#g" \
|
||||
-e "s#@LD@#$LD#g" \
|
||||
-e "s#@LDFLAGS@#$LDFLAGS#g" \
|
||||
-e "s#@PTHREAD_CFLAGS@#$PTHREAD_CFLAGS#g" \
|
||||
-e "s#@MANDIR@#$MANDIR#g" \
|
||||
-e "s#@GZIP@#$GZIP#g" \
|
||||
-e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \
|
||||
-e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \
|
||||
-e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \
|
||||
-e "s#@VMA_BITS@#$VMA_BITS_R#g" \
|
||||
-e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \
|
||||
-e "s#@MM@#$MM#g" \
|
||||
-e "s#@BUILD_DIR@#$P_PWD#g" \
|
||||
-e "s#@SRC_DIR@#$BUILD_DIR#g" \
|
||||
-e "s#@LDNAME@#$LDNAME#g" \
|
||||
-e "s#@LDNAME_MAJOR@#$LDNAME_MAJOR#g" \
|
||||
-e "s#@LDNAME_VERSION@#$LDNAME_VERSION#g" \
|
||||
-e "s#@PC_CFLAGS@#$PC_CFLAGS#g" \
|
||||
-e "s#@GIT_SHA@#$GIT_SHA#g" \
|
||||
$1 > $2
|
||||
}
|
||||
|
||||
generate_stdout()
|
||||
{
|
||||
|
||||
echo
|
||||
echo " VERSION = $VERSION"
|
||||
echo " GIT_SHA = $GIT_SHA"
|
||||
echo " BUILD_DIR = $P_PWD"
|
||||
echo " SRC_DIR = $BUILD_DIR"
|
||||
echo " SYSTEM = $SYSTEM"
|
||||
echo " PROFILE = $PROFILE"
|
||||
echo " CC = $CC"
|
||||
echo " COMPILER = $COMPILER"
|
||||
echo " CFLAGS = $CFLAGS"
|
||||
echo " PTHREAD_CFLAGS = $PTHREAD_CFLAGS"
|
||||
echo " LD = $LD"
|
||||
echo " LDNAME = $LDNAME"
|
||||
echo " LDNAME_VERSION = $LDNAME_VERSION"
|
||||
echo " LDNAME_MAJOR = $LDNAME_MAJOR"
|
||||
echo " LDFLAGS = $LDFLAGS"
|
||||
echo " GZIP = $GZIP"
|
||||
echo " CORES = $CORES"
|
||||
echo " POINTER_PACK = $POINTER_PACK_ENABLE"
|
||||
echo " VMA_BITS = $VMA_BITS"
|
||||
echo " MEMORY_MODEL = $MM"
|
||||
echo " RTM = $RTM_ENABLE"
|
||||
echo
|
||||
echo "Headers will be installed in $HEADERS"
|
||||
echo "Libraries will be installed in $LIBRARY"
|
||||
echo "Documentation will be installed in $MANDIR"
|
||||
}
|
||||
|
||||
for option; do
|
||||
case "$option" in
|
||||
*=?*)
|
||||
value=`expr -- "$option" : '[^=]*=\(.*\)'`
|
||||
;;
|
||||
*=)
|
||||
value=
|
||||
;;
|
||||
*)
|
||||
value=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$option" in
|
||||
--help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo
|
||||
echo "The following options may be used for cross-building."
|
||||
echo " --profile=N Use custom build profile (use in conjunction with \$CC)"
|
||||
echo
|
||||
echo "The following options may be used to modify installation behavior."
|
||||
echo " --includedir=N Headers directory (default is ${PREFIX}/include)"
|
||||
echo " --libdir=N Libraries directory (default is ${PREFIX}/lib)"
|
||||
echo " --mandir=N Manual pages directory (default is ${PREFIX}/man)"
|
||||
echo " --prefix=N Installs library files in N (default is $PREFIX)"
|
||||
echo
|
||||
echo "The following options will affect generated code."
|
||||
echo " --enable-pointer-packing Assumes address encoding is subset of pointer range"
|
||||
echo " --enable-rtm Enable restricted transactional memory (power, x86_64)"
|
||||
echo " --memory-model=N Specify memory model (currently tso, pso or rmo)"
|
||||
echo " --vma-bits=N Specify valid number of VMA bits"
|
||||
echo " --platform=N Force the platform type, instead of relying on autodetection"
|
||||
echo " --use-cc-builtins Use the compiler atomic bultin functions, instead of the CK implementation"
|
||||
echo
|
||||
echo "The following options affect regression testing."
|
||||
echo " --cores=N Specify number of cores available on target machine"
|
||||
echo
|
||||
echo "The following environment variables may be used:"
|
||||
echo " CC C compiler command"
|
||||
echo " CFLAGS C compiler flags"
|
||||
echo " LDFLAGS Linker flags"
|
||||
echo " GZIP GZIP compression tool"
|
||||
echo
|
||||
echo "Report bugs to ${MAINTAINER}."
|
||||
exit $EXIT_SUCCESS
|
||||
;;
|
||||
--memory-model=*)
|
||||
case "$value" in
|
||||
"tso")
|
||||
MM="CK_MD_TSO"
|
||||
;;
|
||||
"rmo")
|
||||
MM="CK_MD_RMO"
|
||||
;;
|
||||
"pso")
|
||||
MM="CK_MD_PSO"
|
||||
;;
|
||||
*)
|
||||
echo "./configure [--help]"
|
||||
exit $EXIT_FAILURE
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
--vma-bits=*)
|
||||
VMA_BITS=$value
|
||||
;;
|
||||
--enable-pointer-packing)
|
||||
POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_ENABLE"
|
||||
;;
|
||||
--enable-rtm)
|
||||
RTM_ENABLE_SET="CK_MD_RTM_ENABLE"
|
||||
;;
|
||||
--cores=*)
|
||||
CORES=$value
|
||||
;;
|
||||
--profile=*)
|
||||
PROFILE=$value
|
||||
;;
|
||||
--prefix=*)
|
||||
PREFIX=$value
|
||||
;;
|
||||
--includedir=*)
|
||||
HEADERS=$value
|
||||
;;
|
||||
--libdir=*)
|
||||
LIBRARY=$value
|
||||
;;
|
||||
--mandir=*)
|
||||
MANDIR=$value
|
||||
;;
|
||||
--with-pic)
|
||||
WANT_PIC=yes
|
||||
;;
|
||||
--without-pic)
|
||||
WANT_PIC=no
|
||||
;;
|
||||
--disable-option-checking)
|
||||
OPTION_CHECKING=0
|
||||
;;
|
||||
--use-cc-builtins)
|
||||
USE_CC_BUILTINS=1
|
||||
;;
|
||||
--platform=*)
|
||||
PLATFORM=$value
|
||||
;;
|
||||
--build=*|--host=*|--target=*|--exec-prefix=*|--bindir=*|--sbindir=*|\
|
||||
--sysconfdir=*|--datadir=*|--libexecdir=*|--localstatedir=*|\
|
||||
--enable-static|\
|
||||
--sharedstatedir=*|--infodir=*|--enable-shared|--disable-shared|\
|
||||
--cache-file=*|--srcdir=*)
|
||||
# ignore for compat with regular configure
|
||||
;;
|
||||
--*)
|
||||
if test "$OPTION_CHECKING" -eq 1; then
|
||||
echo "$0 [--help]"
|
||||
echo "Unknown option $option"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
;;
|
||||
*=*)
|
||||
NAME=`expr -- "$option" : '\([^=]*\)='`
|
||||
eval "$NAME='$value'"
|
||||
export $NAME
|
||||
;;
|
||||
*)
|
||||
echo "$0 [--help]"
|
||||
echo "Unknown option $option"
|
||||
exit $EXIT_FAILURE
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
HEADERS=${HEADERS:-"${PREFIX}/include"}
|
||||
LIBRARY=${LIBRARY:-"${PREFIX}/lib"}
|
||||
MANDIR=${MANDIR:-"${PREFIX}/share/man"}
|
||||
GZIP=${GZIP:-"gzip -c"}
|
||||
POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"}
|
||||
RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"}
|
||||
VMA_BITS=${VMA_BITS:-"unknown"}
|
||||
|
||||
DCORES=2
|
||||
printf "Detecting operating system......."
|
||||
SYSTEM=`uname -s 2> /dev/null`
|
||||
case "$SYSTEM" in
|
||||
"SunOS")
|
||||
SYSTEM=solaris
|
||||
;;
|
||||
"Linux"|"uClinux")
|
||||
DCORES=`egrep '(^CPU[0-9]+|^processor.*:.*)' /proc/cpuinfo|wc -l`
|
||||
SYSTEM=linux
|
||||
;;
|
||||
"FreeBSD"|"GNU/kFreeBSD")
|
||||
DCORES=`sysctl -n hw.ncpu`
|
||||
SYSTEM=freebsd
|
||||
;;
|
||||
"NetBSD")
|
||||
DCORES=`sysctl -n hw.ncpu`
|
||||
SYSTEM=netbsd
|
||||
;;
|
||||
"OpenBSD")
|
||||
DCORES=`sysctl -n hw.ncpu`
|
||||
SYSTEM=openbsd
|
||||
;;
|
||||
"DragonFly")
|
||||
DCORES=`sysctl -n hw.ncpu`
|
||||
SYSTEM=dragonflybsd
|
||||
;;
|
||||
"Darwin")
|
||||
DCORES=`sysctl -n hw.ncpu`
|
||||
SYSTEM=darwin
|
||||
;;
|
||||
MINGW32*)
|
||||
SYSTEM=mingw32
|
||||
LDFLAGS="-mthreads $LDFLAGS"
|
||||
;;
|
||||
CYGWIN_NT*)
|
||||
SYSTEM=cygwin
|
||||
LDFLAGS="-mthreads $LDFLAGS"
|
||||
;;
|
||||
*)
|
||||
SYSTEM=
|
||||
;;
|
||||
esac
|
||||
|
||||
assert "$SYSTEM" "$SYSTEM" "unsupported"
|
||||
|
||||
CORES=${CORES:-${DCORES}}
|
||||
printf "Detecting machine architecture..."
|
||||
if test "x$PLATFORM" = "x"; then
|
||||
PLATFORM=`uname -m 2> /dev/null`
|
||||
fi
|
||||
|
||||
case $PLATFORM in
|
||||
"macppc"|"Power Macintosh"|"powerpc")
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
MM="${MM:-"CK_MD_RMO"}"
|
||||
PLATFORM=ppc
|
||||
ENVIRONMENT=32
|
||||
LDFLAGS="-m32 $LDFLAGS"
|
||||
;;
|
||||
"sun4u"|"sun4v"|"sparc64")
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
MM="${MM:-"CK_MD_TSO"}"
|
||||
PLATFORM=sparcv9
|
||||
ENVIRONMENT=64
|
||||
LDFLAGS="-m64 $LDFLAGS"
|
||||
;;
|
||||
i386|i486|i586|i686|i586_i686|pentium*|athlon*|k5|k6|k6_2|k6_3)
|
||||
MM="${MM:-"CK_MD_TSO"}"
|
||||
case $SYSTEM in
|
||||
darwin)
|
||||
ENVIRONMENT=64
|
||||
PLATFORM=x86_64
|
||||
;;
|
||||
freebsd)
|
||||
PLATFORM=x86
|
||||
ENVIRONMENT=32
|
||||
|
||||
# FreeBSD doesn't give us a nice way to determine the CPU
|
||||
# class of the running system, reporting any 32-bit x86
|
||||
# architecture as i386. 486 is its minimum supported CPU
|
||||
# class and cmpxchg8b was implemented first in i586.
|
||||
dmesg | grep -q "486-class"
|
||||
if test "$?" -eq 0; then
|
||||
assert "" "" "Must have an i586 class or higher CPU"
|
||||
fi
|
||||
|
||||
# FreeBSD still generates code for 486-class CPUs as its
|
||||
# default 32-bit target, but we need 586 at the least.
|
||||
echo "$CFLAGS" | grep -q 'march='
|
||||
if test "$?" -ne 0; then
|
||||
# Needed for cmpxchg8b
|
||||
CFLAGS="$CFLAGS -march=i586"
|
||||
fi
|
||||
;;
|
||||
linux)
|
||||
case $PLATFORM in
|
||||
i386|i486)
|
||||
assert "" "" "Must have an i586 class or higher CPU"
|
||||
;;
|
||||
esac
|
||||
|
||||
PLATFORM=x86
|
||||
ENVIRONMENT=32
|
||||
;;
|
||||
|
||||
*)
|
||||
PLATFORM=x86
|
||||
ENVIRONMENT=32
|
||||
assert "$PLATFORM $ENVIRONMENT" "$PLATFORM $ENVIRONMENT" "unsupported"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"amd64"|"x86_64")
|
||||
PLATFORM=x86_64
|
||||
ENVIRONMENT=64
|
||||
LDFLAGS="-m64 $LDFLAGS"
|
||||
MM="${MM:-"CK_MD_TSO"}"
|
||||
;;
|
||||
"i86pc")
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
MM="${MM:-"CK_MD_TSO"}"
|
||||
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"}
|
||||
PLATFORM=x86_64
|
||||
ENVIRONMENT=64
|
||||
;;
|
||||
*)
|
||||
PLATFORM=x86
|
||||
ENVIRONMENT=32
|
||||
assert "$PLATFORM $ENVIRONMENT" "$PLATFORM $ENVIRONMENT" "unsupported"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ppc64"|"ppc64le")
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
MM="${MM:-"CK_MD_RMO"}"
|
||||
PLATFORM=ppc64
|
||||
ENVIRONMENT=64
|
||||
;;
|
||||
arm|armv6l|armv7l)
|
||||
if test "$PLATFORM" = "armv6l"; then
|
||||
CFLAGS="$CFLAGS -march=armv6k";
|
||||
elif test "$PLATFORM" = "armv7l"; then
|
||||
CFLAGS="$CFLAGS -march=armv7-a";
|
||||
fi
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
MM="${MM:-"CK_MD_RMO"}"
|
||||
PLATFORM=arm
|
||||
ENVIRONMENT=32
|
||||
;;
|
||||
"arm64"|"aarch64")
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
MM="${MM:-"CK_MD_RMO"}"
|
||||
PLATFORM=aarch64
|
||||
ENVIRONMENT=64
|
||||
;;
|
||||
*)
|
||||
RTM_ENABLE="CK_MD_RTM_DISABLE"
|
||||
PLATFORM=
|
||||
MM="${MM:-"CK_MD_RMO"}"
|
||||
;;
|
||||
esac
|
||||
|
||||
assert "$PLATFORM" "$PLATFORM" "unsupported"
|
||||
|
||||
if test "$VMA" = "unknown"; then
|
||||
VMA_BITS_R="CK_MD_VMA_BITS_UNKNOWN"
|
||||
VMA_BITS_VALUE_R=""
|
||||
POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_DISABLE"
|
||||
else
|
||||
VMA_BITS_R="CK_MD_VMA_BITS"
|
||||
VMA_BITS_VALUE_R="${VMA_BITS}ULL"
|
||||
fi
|
||||
|
||||
if test "$USE_CC_BUILTINS"; then
|
||||
CFLAGS="$CFLAGS -DCK_CC_BUILTINS"
|
||||
PC_CFLAGS="-DCK_CC_BULITINS"
|
||||
fi
|
||||
|
||||
# `which` on Solaris sucks
|
||||
pathsearch()
|
||||
{
|
||||
what=$1
|
||||
oldFS="$IFS"
|
||||
IFS=":"
|
||||
for d in $PATH ; do
|
||||
if test -x "$d/$what" ; then
|
||||
echo "$d/$what";
|
||||
IFS="$oldFS"
|
||||
return
|
||||
fi
|
||||
done
|
||||
IFS="$oldFS"
|
||||
}
|
||||
|
||||
printf "Finding dirname command.........."
|
||||
DIRNAME=`pathsearch "${DIRNAME:-dirname}"`
|
||||
if test -z "$DIRNAME" -o ! -x "$DIRNAME"; then
|
||||
DIRNAME=`pathsearch "${DIRNAME:-dirname}"`
|
||||
DIRNAME="$DIRNAME"
|
||||
else
|
||||
echo "success [$DIRNAME]"
|
||||
fi
|
||||
|
||||
if test -z "$DIRNAME"; then
|
||||
echo "not found (out of source build unsupported)"
|
||||
else
|
||||
printf "Determining build directory......"
|
||||
|
||||
BUILD_DIR=`$DIRNAME $0`
|
||||
cd `$DIRNAME $0`
|
||||
BUILD_DIR=`pwd`
|
||||
|
||||
echo "success [$BUILD_DIR]"
|
||||
fi
|
||||
|
||||
printf "Finding gzip tool................"
|
||||
GZIP=`pathsearch "${GZIP:-gzip}"`
|
||||
if test -z "$GZIP" -o ! -x "$GZIP"; then
|
||||
GZIP=`pathsearch "${GZIP:-gzip}"`
|
||||
GZIP="$GZIP"
|
||||
fi
|
||||
|
||||
if test -z "$GZIP"; then
|
||||
echo "not found"
|
||||
GZIP=cat
|
||||
GZIP_SUFFIX=""
|
||||
else
|
||||
echo "success [$GZIP]"
|
||||
GZIP="$GZIP -c"
|
||||
GZIP_SUFFIX=".gz"
|
||||
fi
|
||||
|
||||
printf "Finding suitable compiler........"
|
||||
CC=`pathsearch "${CC:-cc}"`
|
||||
if test -z "$CC" -o ! -x "$CC"; then
|
||||
CC=`pathsearch "${CC:-gcc}"`
|
||||
fi
|
||||
assert "$CC" "not found"
|
||||
|
||||
cat << EOF > .1.c
|
||||
#include <stdio.h>
|
||||
int main(void) {
|
||||
#if defined(_WIN32)
|
||||
#if defined(__MINGW64__)
|
||||
puts("mingw64");
|
||||
return (0);
|
||||
#elif defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION >= 3)
|
||||
puts("mingw32");
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif /* __MINGW32__ && __MINGW32_MAJOR_VERSION >= 3 */
|
||||
#elif defined(__clang__) && (__clang_major__ >= 3)
|
||||
puts("clang");
|
||||
return (0);
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5110)
|
||||
puts("suncc");
|
||||
return (0);
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
puts("gcc");
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
EOF
|
||||
|
||||
$CC -o .1 .1.c
|
||||
COMPILER=`./.1`
|
||||
r=$?
|
||||
rm -f .1.c .1
|
||||
|
||||
if test "$r" -ne 0; then
|
||||
assert "" "update compiler"
|
||||
else
|
||||
echo "success [$CC]"
|
||||
fi
|
||||
|
||||
if test "$COMPILER" = "suncc"; then
|
||||
LD=/bin/ld
|
||||
LDFLAGS="-G -z text -h libck.so.$VERSION_MAJOR $LDFLAGS"
|
||||
CFLAGS="-xO5 $CFLAGS"
|
||||
PTHREAD_CFLAGS="-mt -lpthread"
|
||||
elif test "$COMPILER" = "gcc" || test "$COMPILER" = "clang" || test "$COMPILER" = "mingw32" || test "$COMPILER" = "mingw64"; then
|
||||
LD=$CC
|
||||
SONAME="$LDNAME_MAJOR"
|
||||
if test "$SYSTEM" = "darwin"; then
|
||||
CC_WL_OPT="-install_name"
|
||||
LDNAME="libck.dylib"
|
||||
LDNAME_VERSION="libck.$VERSION.dylib"
|
||||
LDNAME_MAJOR="libck.$VERSION_MAJOR.dylib"
|
||||
SONAME="$LIBRARY/$LDNAME_MAJOR"
|
||||
else
|
||||
CC_WL_OPT="-soname"
|
||||
fi
|
||||
|
||||
LDFLAGS="-Wl,$CC_WL_OPT,$SONAME $LDFLAGS"
|
||||
if test "$WANT_PIC" = "yes"; then
|
||||
LDFLAGS="$LDFLAGS -shared -fPIC"
|
||||
CFLAGS="$CFLAGS -fPIC"
|
||||
ALL_LIBS="libck.so libck.a"
|
||||
INSTALL_LIBS="install-so install-lib"
|
||||
else
|
||||
LDFLAGS="$LDFLAGS -fno-PIC"
|
||||
CFLAGS="$CFLAGS -fno-PIC"
|
||||
ALL_LIBS="libck.a"
|
||||
INSTALL_LIBS="install-lib"
|
||||
fi
|
||||
|
||||
CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -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
|
||||
PLATFORM=x86_64
|
||||
fi
|
||||
else
|
||||
assert "" "unknown compiler"
|
||||
fi
|
||||
|
||||
printf "Detecting VMA bits..............."
|
||||
VMA="unknown"
|
||||
if test "$VMA_BITS" = "unknown"; then
|
||||
if test "$PLATFORM" = "x86" || test $PLATFORM = "x86_64"; then
|
||||
case $SYSTEM in
|
||||
darwin)
|
||||
VMA=`sysctl -n machdep.cpu.address_bits.virtual`
|
||||
;;
|
||||
linux)
|
||||
VMA=`awk '/address sizes/ {print $7;exit}' /proc/cpuinfo`
|
||||
;;
|
||||
*)
|
||||
if test "$PLATFORM" = "x86"; then
|
||||
VMA="32"
|
||||
else
|
||||
cat << EOF > .1.c
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
unsigned long ret = 0x80000000;
|
||||
|
||||
__asm __volatile("cpuid\n"
|
||||
: "+a" (ret));
|
||||
if (ret >= 0x80000008) {
|
||||
ret = 0x80000008;
|
||||
__asm __volatile("cpuid\n"
|
||||
: "+a" (ret));
|
||||
printf("%lu\n", (ret >> 8) & 0xff);
|
||||
} else {
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
EOF
|
||||
|
||||
$CC -o .1 .1.c 2>/dev/null
|
||||
VMA=`./.1 2>/dev/null`
|
||||
if test $? -ne 0; then
|
||||
VMA="unknown"
|
||||
fi
|
||||
rm -f .1.c .1
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
|
||||
VMA_BITS=$VMA
|
||||
else
|
||||
VMA=$VMA_BITS
|
||||
fi
|
||||
|
||||
if test "$VMA" = "unknown"; then
|
||||
echo "unknown"
|
||||
VMA_BITS_R="CK_MD_VMA_BITS_UNKNOWN"
|
||||
VMA_BITS_VALUE_R=""
|
||||
POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_DISABLE"
|
||||
else
|
||||
echo "success [$VMA]"
|
||||
VMA_BITS_R="CK_MD_VMA_BITS"
|
||||
VMA_BITS_VALUE_R="${VMA_BITS}ULL"
|
||||
fi
|
||||
|
||||
for i in $REQUIRE_HEADER; do
|
||||
printf "Checking header file usability..."
|
||||
|
||||
cat << EOF > .1.c
|
||||
#include <$i>
|
||||
int main(void){return(0);}
|
||||
EOF
|
||||
$CC -o .1 .1.c 2> /dev/null
|
||||
hf_s=$?
|
||||
|
||||
rm -f .1 .1.c
|
||||
if test $hf_s -eq 0; then
|
||||
echo "success [$i]"
|
||||
else
|
||||
echo "failed [$i]"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
done
|
||||
|
||||
printf "Detecting git SHA................"
|
||||
get_git_sha
|
||||
echo "$GIT_MSG [$GIT_SHA]"
|
||||
|
||||
if test "$PROFILE"; then
|
||||
printf "Using user-specified profile....."
|
||||
|
||||
if test -z "$CC"; then
|
||||
echo "failed [specify compiler]"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
if test ! -f build/ck.build.$PROFILE; then
|
||||
echo "failed [$PROFILE]"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
echo "success [$PROFILE]"
|
||||
printf "Generating header files.........."
|
||||
generate include/ck_md.h.in include/ck_md.h
|
||||
echo "success"
|
||||
printf "Generating build files..........."
|
||||
generate src/Makefile.in src/Makefile
|
||||
generate doc/Makefile.in doc/Makefile
|
||||
generate build/ck.build.in build/ck.build
|
||||
generate build/regressions.build.in build/regressions.build
|
||||
generate build/ck.pc.in build/ck.pc
|
||||
generate build/ck.spec.in build/ck.spec
|
||||
generate Makefile.in Makefile
|
||||
echo "success"
|
||||
generate_stdout
|
||||
exit $EXIT_SUCCESS
|
||||
fi
|
||||
|
||||
# Platform will be used as a macro.
|
||||
PROFILE="${PROFILE:-$PLATFORM}"
|
||||
PLATFORM="__${PLATFORM}__"
|
||||
|
||||
printf "Generating header files.........."
|
||||
generate include/ck_md.h.in include/ck_md.h
|
||||
echo "success"
|
||||
|
||||
printf "Generating build files..........."
|
||||
|
||||
mkdir -p $P_PWD/doc
|
||||
mkdir -p $P_PWD/build
|
||||
mkdir -p $P_PWD/include
|
||||
mkdir -p $P_PWD/src
|
||||
|
||||
if test "$P_PWD" '!=' "$BUILD_DIR"; then
|
||||
mkdir -p $P_PWD/regressions
|
||||
cp $BUILD_DIR/regressions/Makefile.unsupported $P_PWD/regressions/Makefile &> /dev/null
|
||||
cp $BUILD_DIR/build/ck.build.$PROFILE $P_PWD/build/ck.build.$PROFILE &> /dev/null
|
||||
cp $BUILD_DIR/include/ck_md.h $P_PWD/include/ck_md.h &> /dev/null
|
||||
fi
|
||||
|
||||
generate src/Makefile.in $P_PWD/src/Makefile
|
||||
generate doc/Makefile.in $P_PWD/doc/Makefile
|
||||
generate build/ck.build.in $P_PWD/build/ck.build
|
||||
generate build/regressions.build.in $P_PWD/build/regressions.build
|
||||
generate build/ck.pc.in $P_PWD/build/ck.pc
|
||||
generate build/ck.spec.in $P_PWD/build/ck.spec
|
||||
generate Makefile.in $P_PWD/Makefile
|
||||
touch src/*.c
|
||||
echo "success"
|
||||
generate_stdout
|
79
doc/CK_ARRAY_FOREACH
Normal file
79
doc/CK_ARRAY_FOREACH
Normal file
@ -0,0 +1,79 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_FOREACH 3
|
||||
.Sh NAME
|
||||
.Nm CK_ARRAY_FOREACH
|
||||
.Nd iterate through an array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft bool
|
||||
.Fn CK_ARRAY_FOREACH "ck_array_t *array" "ck_array_iterator_t *iterator" "void **b"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn CK_ARRAY_FOREACH 3
|
||||
macro iterates through the array pointed to by
|
||||
.Fa array .
|
||||
A pointer to an iterator object must be specified by
|
||||
.Fa iterator
|
||||
and
|
||||
.Fa b
|
||||
must point to a void pointer.
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
#include <ck_array.h>
|
||||
|
||||
/* Assume this was already previously initialized. */
|
||||
ck_array_t array;
|
||||
|
||||
void
|
||||
example(void)
|
||||
{
|
||||
ck_array_iterator_t iterator;
|
||||
void *pointer;
|
||||
|
||||
CK_ARRAY_FOREACH(&array, &iterator, &pointer) {
|
||||
do_something(pointer);
|
||||
}
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
This macro has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_init 3 ,
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_deinit 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
66
doc/CK_COHORT_INIT
Normal file
66
doc/CK_COHORT_INIT
Normal file
@ -0,0 +1,66 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_COHORT_INIT 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_INIT
|
||||
.Nd initialize instance of a cohort type
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_INIT "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_lock" \
|
||||
"void *local_lock" "unsigned int pass_limit"
|
||||
.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
|
||||
.Fa cohort
|
||||
argument will use the lock pointed to by
|
||||
.Fa global_lock
|
||||
as its global lock and the lock pointed to by
|
||||
.Fa local_lock
|
||||
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
|
||||
.Fa pass_limit
|
||||
argument, you should use CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
59
doc/CK_COHORT_INSTANCE
Normal file
59
doc/CK_COHORT_INSTANCE
Normal file
@ -0,0 +1,59 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_COHORT_INSTANCE 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_INSTANCE
|
||||
.Nd declare an instance of a cohort type
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_INSTANCE "COHORT_NAME cohort_name"
|
||||
.Sh DESCRIPTION
|
||||
The user must use this macro to declare instances of cohort types that they have
|
||||
defined. For instance, if they have used the CK_COHORT_PROTOTYPE macro to define
|
||||
a cohort type with name foo, they would create an instance of this type as follows:
|
||||
.br
|
||||
CK_COHORT_INSTANCE(foo) cohort;
|
||||
.Pp
|
||||
This macro should also be used when allocating memory for cohorts. For instance,
|
||||
to allocate a block of 4 cohorts:
|
||||
.br
|
||||
CK_COHORT_INSTANCE(foo) *cohorts = malloc(4 * sizeof(CK_COHORT_INSTANCE(foo)));
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
61
doc/CK_COHORT_LOCK
Normal file
61
doc/CK_COHORT_LOCK
Normal file
@ -0,0 +1,61 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_COHORT_LOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_LOCK
|
||||
.Nd acquire cohort lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_LOCK "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_context" \
|
||||
"void *local_context"
|
||||
.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.
|
||||
.Fa global_context
|
||||
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
|
||||
.Fa local_context
|
||||
will be passed to the function specified by
|
||||
.Fa local_lock_method
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_INIT 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
76
doc/CK_COHORT_PROTOTYPE
Normal file
76
doc/CK_COHORT_PROTOTYPE
Normal file
@ -0,0 +1,76 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_COHORT_PROTOTYPE 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_PROTOTYPE
|
||||
.Nd define cohort type with specified lock types
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_PROTOTYPE "COHORT_NAME cohort_name" "TYPE global_lock_method" \
|
||||
"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
|
||||
.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.
|
||||
The CK_COHORT_PROTOTYPE macro takes the following arguments:
|
||||
.Pp
|
||||
.Fa cohort_name
|
||||
: An identifier used for this cohort type. This will have to be passed to each
|
||||
of the other CK_COHORT macros.
|
||||
.br
|
||||
.Fa global_lock_method
|
||||
: The method that should be called to acquire the global lock
|
||||
.br
|
||||
.Fa global_unlock_method
|
||||
: The method that should be called to relinquish the global lock
|
||||
.br
|
||||
.Fa local_lock_method
|
||||
: The method that should be called to acquire the local lock
|
||||
.br
|
||||
.Fa local_unlock_method
|
||||
: The method that should be called to relinquish the local lock
|
||||
.Pp
|
||||
Instances of the defined cohort type can be declared as:
|
||||
.br
|
||||
CK_COHORT_INSTANCE(cohort_name) cohort;
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_INIT 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
69
doc/CK_COHORT_TRYLOCK
Normal file
69
doc/CK_COHORT_TRYLOCK
Normal file
@ -0,0 +1,69 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 9, 2013.
|
||||
.Dt CK_COHORT_TRYLOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_TRYLOCK
|
||||
.Nd try to acquire cohort lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_TRYLOCK "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_trylock_context" \
|
||||
"void *local_trylock_context" "void *lock_unlock_context"
|
||||
.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
|
||||
.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.
|
||||
.Fa global_trylock_context
|
||||
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
|
||||
.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
|
||||
local lock as well, and
|
||||
.Fa local_unlock_context
|
||||
will be passed to the function specified by
|
||||
.Fa local_unlock_method
|
||||
when this call is made.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_INIT 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
90
doc/CK_COHORT_TRYLOCK_PROTOTYPE
Normal file
90
doc/CK_COHORT_TRYLOCK_PROTOTYPE
Normal file
@ -0,0 +1,90 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 9, 2013.
|
||||
.Dt CK_COHORT_TRYLOCK_PROTOTYPE 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_TRYLOCK_PROTOTYPE
|
||||
.Nd define cohort type with specified lock types
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_TRYLOCK_PROTOTYPE "COHORT_NAME cohort_name" "LOCK_FXN global_lock_method" \
|
||||
"LOCK_FXN global_unlock_method" "BOOL_LOCK_FXN global_locked_method" \
|
||||
"BOOL_LOCK_FXN global_trylock_method" "LOCK_FXN local_lock_method" \
|
||||
"LOCK_FXN local_unlock_method" "BOOL_LOCK_FXN local_locked_method" "BOOL_LOCK_FXN local_trylock_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 CK_COHORT_TRYLOCK_PROTOTYPE macros to define any types
|
||||
they want to use. They must use CK_COHORT_TRYLOCK_PROTOTYPE if they want their cohort type to have support
|
||||
for trylock operations. The CK_COHORT_TRYLOCK_PROTOTYPE macro takes the following arguments:
|
||||
.Pp
|
||||
.Fa cohort_name
|
||||
: An identifier used for this cohort type. This will have to be passed to each
|
||||
of the other CK_COHORT macros.
|
||||
.br
|
||||
.Fa global_lock_method
|
||||
: The method that should be called to acquire the global lock
|
||||
.br
|
||||
.Fa global_unlock_method
|
||||
: The method that should be called to relinquish the global lock
|
||||
.br
|
||||
.Fa global_locked_method
|
||||
: 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.
|
||||
It should not block and return true iff the lock was successfully acquired.
|
||||
.br
|
||||
.Fa local_lock_method
|
||||
: The method that should be called to acquire the local lock
|
||||
.br
|
||||
.Fa local_unlock_method
|
||||
: The method that should be called to relinquish the local lock
|
||||
.br
|
||||
.Fa global_locked_method
|
||||
: 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.
|
||||
It should not block and return true iff the lock was successfully acquired.
|
||||
.Pp
|
||||
Instances of the defined cohort type can be declared as:
|
||||
.br
|
||||
CK_COHORT_INSTANCE(cohort_name) cohort;
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_INIT 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
61
doc/CK_COHORT_UNLOCK
Normal file
61
doc/CK_COHORT_UNLOCK
Normal file
@ -0,0 +1,61 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_COHORT_UNLOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_COHORT_UNLOCK
|
||||
.Nd release cohort lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_UNLOCK "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_context" \
|
||||
"void *local_context"
|
||||
.Sh DESCRIPTION
|
||||
This call instructs
|
||||
.Fa cohort
|
||||
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
|
||||
.Fa global_lock_method
|
||||
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
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_INIT 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
71
doc/CK_HS_HASH
Normal file
71
doc/CK_HS_HASH
Normal file
@ -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_HS_HASH 3
|
||||
.Sh NAME
|
||||
.Nm CK_HS_HASH
|
||||
.Nd invoke hash function with hash set seed
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft unsigned long
|
||||
.Fn CK_HS_HASH "ck_hs_t *hs" "ck_hs_hash_cb_t *hf" "const void *key"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn CK_HS_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_hs_init 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_hs_init 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_remove 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_count 3 ,
|
||||
.Xr ck_hs_reset 3 ,
|
||||
.Xr ck_hs_stat 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
71
doc/CK_RHS_HASH
Normal file
71
doc/CK_RHS_HASH
Normal file
@ -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/
|
61
doc/CK_RWCOHORT_INIT
Normal file
61
doc/CK_RWCOHORT_INIT
Normal file
@ -0,0 +1,61 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_INIT 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_INIT
|
||||
.Nd initialize instance of a cohort-based reader-writer lock type
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_rwcohort.h
|
||||
.Fn CK_RWCOHORT_NEUTRAL_INIT "COHORT_NAME cohort_name" "LOCK *lock"
|
||||
.Fn CK_RWCOHORT_RP_INIT "COHORT_NAME cohort_name" "LOCK *lock" "unsigned int wait_limit"
|
||||
.Fn CK_RWCOHORT_WP_INIT "COHORT_NAME cohort_name" "LOCK *lock" "unsigned int wait_limit"
|
||||
.Sh DESCRIPTION
|
||||
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
|
||||
.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
|
||||
.Fa wait_limit
|
||||
argument, you should use CK_RWCOHORT_STRATEGY_DEFAULT_LOCAL_WAIT_LIMIT.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_rwcohort 3 ,
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_UNLOCK 3 ,
|
||||
.Xr CK_RWCOHORT_LOCKED 3 ,
|
||||
.Xr CK_RWCOHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
64
doc/CK_RWCOHORT_INSTANCE
Normal file
64
doc/CK_RWCOHORT_INSTANCE
Normal file
@ -0,0 +1,64 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_INSTANCE 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_INSTANCE
|
||||
.Nd declare an instance of a cohort-based reader-writer lock type
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_RWCOHORT_NEUTRAL_INSTANCE "COHORT_NAME cohort_name"
|
||||
.Fn CK_RWCOHORT_RP_INSTANCE "COHORT_NAME cohort_name"
|
||||
.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
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3
|
||||
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
|
||||
CK_RWCOHORT_INSTANCE(foo) cohort;
|
||||
.Pp
|
||||
This macro should also be used when allocating memory for cohorts. For instance,
|
||||
to allocate a block of 4 cohorts:
|
||||
.br
|
||||
CK_RWCOHORT_WP_INSTANCE(foo) *cohorts = malloc(4 * sizeof(CK_RWCOHORT_WP_INSTANCE(foo)));
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_rwcohort 3 ,
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_UNLOCK 3 ,
|
||||
.Xr CK_RWCOHORT_LOCKED 3 ,
|
||||
.Xr CK_RWCOHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
65
doc/CK_RWCOHORT_PROTOTYPE
Normal file
65
doc/CK_RWCOHORT_PROTOTYPE
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_PROTOTYPE 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_PROTOTYPE
|
||||
.Nd define reader-writer cohort-based lock using the specified cohort type
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_rwcohort.h
|
||||
.Fn CK_RWCOHORT_NEUTRAL_PROTOTYPE "COHORT_NAME cohort_name"
|
||||
.Fn CK_RWCOHORT_RP_PROTOTYPE "COHORT_NAME cohort_name"
|
||||
.Fn CK_RWCOHORT_WP_PROTOTYPE "COHORT_NAME cohort_name"
|
||||
.Sh DESCRIPTION
|
||||
The ck_rwcohort.h header file does not define any cohort types. Instead, the user must use
|
||||
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
|
||||
.Xr CK_COHORT_PROTOTYPE 3
|
||||
or
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
|
||||
macros.
|
||||
.Pp
|
||||
Instances of the defined lock type can be declared as:
|
||||
.br
|
||||
CK_RWCOHORT_INSTANCE(cohort_name) lock;
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_rwcohort 3 ,
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_INIT 3 ,
|
||||
.Xr CK_RWCOHORT_READ_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_READ_UNLOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_UNLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
66
doc/CK_RWCOHORT_READ_LOCK
Normal file
66
doc/CK_RWCOHORT_READ_LOCK
Normal file
@ -0,0 +1,66 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_READ_LOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_READ_LOCK
|
||||
.Nd acquire read-only permission for cohort-based reader-writer lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.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"\
|
||||
"void *global_context" "void *local_context"
|
||||
.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
|
||||
.Fa lock .
|
||||
The
|
||||
.Fa global_context
|
||||
and
|
||||
.Fa local_context
|
||||
arguments will be passed along as the context arguments to any calls to
|
||||
.Fa cohort .
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_INIT 3 ,
|
||||
.Xr CK_RWCOHORT_READ_UNLOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_UNLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
65
doc/CK_RWCOHORT_READ_UNLOCK
Normal file
65
doc/CK_RWCOHORT_READ_UNLOCK
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_READ_UNLOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_READ_UNLOCK
|
||||
.Nd relinquish read-only access to cohort-based reader-writer lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.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"\
|
||||
"void *global_context" "void *local_context"
|
||||
.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 lock .
|
||||
The
|
||||
.Fa global_context
|
||||
and
|
||||
.Fa local_context
|
||||
arguments will be passed along as the context arguments to any calls to
|
||||
.Fa cohort .
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_INIT 3 ,
|
||||
.Xr CK_RWCOHORT_READ_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_UNLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
66
doc/CK_RWCOHORT_WRITE_LOCK
Normal file
66
doc/CK_RWCOHORT_WRITE_LOCK
Normal file
@ -0,0 +1,66 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_WRITE_LOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_WRITE_LOCK
|
||||
.Nd acquite write access for a cohort-based reader-writer lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.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"\
|
||||
"void *global_context" "void *local_context"
|
||||
.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
|
||||
.Fa lock .
|
||||
The
|
||||
.Fa global_context
|
||||
and
|
||||
.Fa local_context
|
||||
arguments will be passed along as the context arguments to any calls to
|
||||
.Fa cohort .
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_INIT 3 ,
|
||||
.Xr CK_RWCOHORT_READ_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_READ_UNLOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_UNLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
65
doc/CK_RWCOHORT_WRITE_UNLOCK
Normal file
65
doc/CK_RWCOHORT_WRITE_UNLOCK
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt CK_RWCOHORT_WRITE_UNLOCK 3
|
||||
.Sh NAME
|
||||
.Nm CK_RWCOHORT_WRITE_UNLOCK
|
||||
.Nd relinquish write access for cohort-based reader-writer lock
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.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"\
|
||||
"void *global_context" "void *local_context"
|
||||
.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 lock .
|
||||
The
|
||||
.Fa global_context
|
||||
and
|
||||
.Fa local_context
|
||||
arguments will be passed along as the context arguments to any calls to
|
||||
.Fa cohort .
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_cohort 3 ,
|
||||
.Xr CK_RWCOHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_RWCOHORT_INSTANCE 3 ,
|
||||
.Xr CK_RWCOHORT_INITIALIZER 3 ,
|
||||
.Xr CK_RWCOHORT_INIT 3 ,
|
||||
.Xr CK_RWCOHORT_READ_LOCK 3 ,
|
||||
.Xr CK_RWCOHORT_READ_UNLOCK 3 ,
|
||||
.Xr CK_RWCOHORT_WRITE_LOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
218
doc/Makefile.in
Normal file
218
doc/Makefile.in
Normal file
@ -0,0 +1,218 @@
|
||||
.PHONY: clean install uninstall
|
||||
|
||||
MANDIR=@MANDIR@
|
||||
GZIP=@GZIP@
|
||||
GZIP_SUFFIX=.3@GZIP_SUFFIX@
|
||||
BUILD_DIR=@BUILD_DIR@
|
||||
SRC_DIR=@SRC_DIR@
|
||||
HTML_SUFFIX=.html
|
||||
|
||||
OBJECTS=CK_ARRAY_FOREACH \
|
||||
ck_array_buffer \
|
||||
ck_array_commit \
|
||||
ck_array_deinit \
|
||||
ck_array_init \
|
||||
ck_array_initialized \
|
||||
ck_array_length \
|
||||
ck_array_put \
|
||||
ck_array_put_unique \
|
||||
ck_array_remove \
|
||||
ck_array_deinit \
|
||||
ck_brlock \
|
||||
ck_ht_count \
|
||||
ck_ht_destroy \
|
||||
ck_ht_gc \
|
||||
ck_ht_get_spmc \
|
||||
ck_ht_grow_spmc \
|
||||
ck_ht_hash \
|
||||
ck_ht_hash_direct \
|
||||
ck_ht_init \
|
||||
ck_ht_put_spmc \
|
||||
ck_ht_remove_spmc \
|
||||
ck_ht_reset_spmc \
|
||||
ck_ht_reset_size_spmc \
|
||||
ck_ht_set_spmc \
|
||||
ck_ht_entry_empty \
|
||||
ck_ht_entry_key \
|
||||
ck_ht_entry_key_direct \
|
||||
ck_ht_entry_key_length \
|
||||
ck_ht_entry_key_set \
|
||||
ck_ht_entry_key_set_direct \
|
||||
ck_ht_entry_set \
|
||||
ck_ht_entry_set_direct \
|
||||
ck_ht_entry_value_direct \
|
||||
ck_ht_entry_value \
|
||||
ck_ht_iterator_init \
|
||||
ck_ht_next \
|
||||
ck_ht_stat \
|
||||
ck_bitmap_init \
|
||||
ck_bitmap_reset \
|
||||
ck_bitmap_set \
|
||||
ck_bitmap_bts \
|
||||
ck_bitmap_test \
|
||||
ck_bitmap_base \
|
||||
ck_bitmap_union \
|
||||
ck_bitmap_size \
|
||||
ck_bitmap_clear \
|
||||
ck_bitmap_bits \
|
||||
ck_bitmap_buffer \
|
||||
ck_bitmap_next \
|
||||
ck_bitmap_iterator_init \
|
||||
ck_elide \
|
||||
ck_epoch_barrier \
|
||||
ck_epoch_begin \
|
||||
ck_epoch_call \
|
||||
ck_epoch_end \
|
||||
ck_epoch_init \
|
||||
ck_epoch_poll \
|
||||
ck_epoch_recycle \
|
||||
ck_epoch_register \
|
||||
ck_epoch_reclaim \
|
||||
ck_epoch_synchronize \
|
||||
ck_epoch_unregister \
|
||||
ck_hs_gc \
|
||||
ck_hs_init \
|
||||
ck_hs_destroy \
|
||||
CK_HS_HASH \
|
||||
ck_hs_apply \
|
||||
ck_hs_iterator_init \
|
||||
ck_hs_next \
|
||||
ck_hs_get \
|
||||
ck_hs_put \
|
||||
ck_hs_put_unique \
|
||||
ck_hs_set \
|
||||
ck_hs_fas \
|
||||
ck_hs_remove \
|
||||
ck_hs_move \
|
||||
ck_hs_grow \
|
||||
ck_hs_rebuild \
|
||||
ck_hs_count \
|
||||
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_put_unique \
|
||||
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 \
|
||||
CK_RWCOHORT_PROTOTYPE \
|
||||
CK_RWCOHORT_READ_LOCK \
|
||||
CK_RWCOHORT_READ_UNLOCK \
|
||||
CK_RWCOHORT_WRITE_LOCK \
|
||||
CK_RWCOHORT_WRITE_UNLOCK \
|
||||
ck_cohort \
|
||||
CK_COHORT_PROTOTYPE \
|
||||
CK_COHORT_TRYLOCK_PROTOTYPE \
|
||||
CK_COHORT_INSTANCE \
|
||||
CK_COHORT_INIT \
|
||||
CK_COHORT_LOCK \
|
||||
CK_COHORT_UNLOCK \
|
||||
CK_COHORT_TRYLOCK \
|
||||
ck_pr \
|
||||
ck_pr_fence_acquire \
|
||||
ck_pr_fence_release \
|
||||
ck_pr_barrier \
|
||||
ck_pr_fas \
|
||||
ck_pr_fence_atomic \
|
||||
ck_pr_fence_atomic_load \
|
||||
ck_pr_fence_atomic_store \
|
||||
ck_pr_fence_load \
|
||||
ck_pr_fence_load_atomic \
|
||||
ck_pr_fence_load_store \
|
||||
ck_pr_fence_load_depends \
|
||||
ck_pr_fence_memory \
|
||||
ck_pr_fence_store \
|
||||
ck_pr_fence_store_atomic \
|
||||
ck_pr_fence_store_load \
|
||||
ck_pr_stall \
|
||||
ck_pr_faa \
|
||||
ck_pr_inc \
|
||||
ck_pr_dec \
|
||||
ck_pr_not \
|
||||
ck_pr_neg \
|
||||
ck_pr_add \
|
||||
ck_pr_sub \
|
||||
ck_pr_and \
|
||||
ck_pr_xor \
|
||||
ck_pr_or \
|
||||
ck_pr_cas \
|
||||
ck_pr_bts \
|
||||
ck_pr_btc \
|
||||
ck_pr_btr \
|
||||
ck_pr_store \
|
||||
ck_pr_load \
|
||||
ck_pr_rtm \
|
||||
ck_queue \
|
||||
ck_ring_init \
|
||||
ck_ring_dequeue_spmc \
|
||||
ck_ring_enqueue_spmc \
|
||||
ck_ring_enqueue_spmc_size \
|
||||
ck_ring_trydequeue_spmc \
|
||||
ck_ring_dequeue_spsc \
|
||||
ck_ring_enqueue_spsc \
|
||||
ck_ring_enqueue_spsc_size \
|
||||
ck_ring_size \
|
||||
ck_ring_capacity \
|
||||
ck_tflock \
|
||||
ck_rwlock \
|
||||
ck_pflock \
|
||||
ck_swlock \
|
||||
ck_sequence \
|
||||
ck_spinlock
|
||||
|
||||
all:
|
||||
for target in $(OBJECTS); do \
|
||||
$(GZIP) $(SRC_DIR)/doc/$$target > $(BUILD_DIR)/doc/$$target$(GZIP_SUFFIX); \
|
||||
done
|
||||
|
||||
html:
|
||||
for target in $(OBJECTS); do \
|
||||
echo $$target; \
|
||||
groff -man -Tascii $(SRC_DIR)/doc/$$target | col -bx > \
|
||||
$(BUILD_DIR)/doc/$$target$(HTML_SUFFIX); \
|
||||
sed -i.bk 's/\&/\&\;/g;s/>/\>\;/g;s/</\<\;/g;' \
|
||||
$(BUILD_DIR)/doc/$$target$(HTML_SUFFIX); \
|
||||
done
|
||||
|
||||
# check for entries that are missing in OBJECTS
|
||||
objcheck: all
|
||||
for file in `ls * | egrep '(ck|CK)_' | egrep -v "($(GZIP_SUFFIX)|$(HTML_SUFFIX))$$"`; do \
|
||||
if [ ! -f $${file}$(GZIP_SUFFIX) ]; then \
|
||||
echo "$$file is missing from OBJECTS" >&2; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# check for stale references
|
||||
refcheck:
|
||||
@./refcheck.pl $(OBJECTS)
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)/$(MANDIR)/man3 || exit
|
||||
cp *$(GZIP_SUFFIX) $(DESTDIR)/$(MANDIR)/man3 || exit
|
||||
|
||||
uninstall:
|
||||
for target in $(OBJECTS); do \
|
||||
rm -f $(DESTDIR)/$(MANDIR)/man3/$$target$(GZIP_SUFFIX); \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/doc/*~ $(BUILD_DIR)/doc/*$(GZIP_SUFFIX) $(BUILD_DIR)/doc/*$(HTML_SUFFIX)
|
||||
|
60
doc/ck_array_buffer
Normal file
60
doc/ck_array_buffer
Normal file
@ -0,0 +1,60 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_BUFFER 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_buffer
|
||||
.Nd return length and pointer to array of reader-visible pointers
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft void *
|
||||
.Fn ck_array_buffer "ck_array_t *array" "unsigned int *length"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_buffer 3
|
||||
returns a pointer to the array of pointers currently visible
|
||||
to readers after the last commit operation in
|
||||
.Fa array .
|
||||
The unsigned integer pointed to by
|
||||
.Fa length
|
||||
is updated to reflect the length of the array.
|
||||
.Sh RETURN VALUES
|
||||
This function returns a pointer to an array of pointers.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_init 3
|
||||
.Xr ck_array_deinit 3 ,
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
58
doc/ck_array_commit
Normal file
58
doc/ck_array_commit
Normal file
@ -0,0 +1,58 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_COMMIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_commit
|
||||
.Nd linearization point for mutations before commit call
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft bool
|
||||
.Fn ck_array_commit "ck_array_t *array"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_commit 3
|
||||
function will commit any pending put or remove operations associated
|
||||
with the array. The function may end up requesting the safe reclamation
|
||||
of memory actively being iterated upon by other threads.
|
||||
.Sh RETURN VALUES
|
||||
This function returns true if the commit operation succeeded. It will
|
||||
return false otherwise, and pending operations will not be applied.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_init 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_deinit 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
62
doc/ck_array_deinit
Normal file
62
doc/ck_array_deinit
Normal file
@ -0,0 +1,62 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_DEINIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_deinit
|
||||
.Nd destroy and deinitialize a pointer array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft void
|
||||
.Fn ck_array_deinit "ck_array_t *array" "bool defer"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_deinit 3
|
||||
destroys the memory associated with the array pointed
|
||||
to by
|
||||
.Fa array .
|
||||
The
|
||||
.Fa defer
|
||||
argument is true if the allocator must destroy
|
||||
the memory using safe memory reclamation or false
|
||||
if the allocator can destroy this memory immediately.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_init 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
69
doc/ck_array_init
Normal file
69
doc/ck_array_init
Normal file
@ -0,0 +1,69 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_init
|
||||
.Nd initialize a pointer array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft bool
|
||||
.Fn ck_array_init "ck_array_t *array" "unsigned int mode" "struct ck_malloc *allocator" "unsigned int initial_length"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_init 3
|
||||
function initializes the array pointed to by the argument
|
||||
.Fa array .
|
||||
The mode value must be
|
||||
.Dv CK_ARRAY_MODE_SPMC .
|
||||
The
|
||||
.Fa allocator
|
||||
argument must point to a ck_malloc data structure with valid non-NULL function pointers
|
||||
initialized for malloc, free and realloc. The
|
||||
.Fa initial_length
|
||||
specifies the initial length of the array. The value of
|
||||
.Fa initial_length
|
||||
must be greater than or equal to 2. An array allows for one concurrent put or remove operations
|
||||
in the presence of any number of concurrent CK_ARRAY_FOREACH operations.
|
||||
.Sh RETURN VALUES
|
||||
This function returns true if the array was successfully created. It returns
|
||||
false if the creation failed. Failure may occur due to internal memory allocation
|
||||
failures or invalid arguments.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_deinit 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
62
doc/ck_array_initialized
Normal file
62
doc/ck_array_initialized
Normal file
@ -0,0 +1,62 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_INITIALIZED 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_initialized
|
||||
.Nd indicates whether an array was recently initialized or deinitialized
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft bool
|
||||
.Fn ck_array_initialized "ck_array_t *array"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_initialized 3
|
||||
can be used to determine whether an array was recently initialized
|
||||
with
|
||||
.Fn ck_array_init 3
|
||||
or deinitialized with
|
||||
.Fn ck_array_deinit 3 .
|
||||
Behavior is undefined if a user allocates internal allocator data
|
||||
in through other means.
|
||||
.Sh RETURN VALUES
|
||||
This function returns true if the array is initialized, and false
|
||||
otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_init 3
|
||||
.Xr ck_array_deinit 3 ,
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
57
doc/ck_array_length
Normal file
57
doc/ck_array_length
Normal file
@ -0,0 +1,57 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_LENGTH 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_length
|
||||
.Nd returns the number of pointers committed to an array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft unsigned int
|
||||
.Fn ck_array_length "ck_array_t *array"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_length 3
|
||||
function returns the number of items a concurrent
|
||||
traversal operation would encounter at completion
|
||||
time.
|
||||
.Sh RETURN VALUES
|
||||
The number of traversal-visible pointers is returned.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_init 3
|
||||
.Xr ck_array_deinit 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
65
doc/ck_array_put
Normal file
65
doc/ck_array_put
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_PUT 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_put
|
||||
.Nd attempt immediate or deferred insertion of a pointer into array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft bool
|
||||
.Fn ck_array_put "ck_array_t *array" "void *pointer"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_put 3
|
||||
function will attempt to insert the value of
|
||||
.Fa pointer
|
||||
into the array pointed to by
|
||||
.Fa array .
|
||||
This function may incur additional memory allocations
|
||||
if not enough memory has been allocated in the array
|
||||
for a new entry. The operation is also free to apply
|
||||
the operation immediately if there is an opportunity
|
||||
for elimination with a pending (uncommitted) remove
|
||||
operation.
|
||||
.Sh RETURN VALUES
|
||||
This function returns true if the put operation succeeded. It will
|
||||
return false otherwise due to internal allocation failures.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_init 3 ,
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_deinit 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
67
doc/ck_array_put_unique
Normal file
67
doc/ck_array_put_unique
Normal file
@ -0,0 +1,67 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_PUT_UNIQUE 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_put_unique
|
||||
.Nd attempt immediate or deferred insertion of a unique pointer into array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft int
|
||||
.Fn ck_array_put_unique "ck_array_t *array" "void *pointer"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_put_unique 3
|
||||
function will attempt to insert the value of
|
||||
.Fa pointer
|
||||
into the array pointed to by
|
||||
.Fa array .
|
||||
This function may incur additional memory allocations
|
||||
if not enough memory has been allocated in the array
|
||||
for a new entry. The operation is also free to apply
|
||||
the operation immediately if there is an opportunity
|
||||
for elimination with a pending (uncommitted) remove
|
||||
operation. The function will not make any modifications
|
||||
if the pointer already exists in the array.
|
||||
.Sh RETURN VALUES
|
||||
This function returns 1 if the pointer already exists in the array.
|
||||
It returns 0 if the put operation succeeded. It returns -1 on
|
||||
error due to internal memory allocation failures.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_init 3 ,
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_put 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_deinit 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
64
doc/ck_array_remove
Normal file
64
doc/ck_array_remove
Normal file
@ -0,0 +1,64 @@
|
||||
.\"
|
||||
.\" 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 October 18, 2013
|
||||
.Dt CK_ARRAY_REMOVE 3
|
||||
.Sh NAME
|
||||
.Nm ck_array_remove
|
||||
.Nd attempt immediate or deferred removal of a pointer from an array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_array.h
|
||||
.Ft bool
|
||||
.Fn ck_array_remove "ck_array_t *array" "void *pointer"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_array_remove 3
|
||||
function will attempt to remove the value of
|
||||
.Fa pointer
|
||||
into the array pointed to by
|
||||
.Fa array . The operation is also free to apply
|
||||
the operation immediately if there is an opportunity
|
||||
for elimination with a pending (uncommitted) put
|
||||
operation. If no elimination was possible, the function
|
||||
may require to allocate more memory.
|
||||
.Sh RETURN VALUES
|
||||
This function returns true if the remove operation succeeded. It will
|
||||
return false otherwise due to internal allocation failures or because
|
||||
the value did not exist.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_array_init 3 ,
|
||||
.Xr ck_array_commit 3 ,
|
||||
.Xr ck_array_remove 3 ,
|
||||
.Xr ck_array_put_unique 3 ,
|
||||
.Xr ck_array_deinit 3
|
||||
.Xr ck_array_length 3 ,
|
||||
.Xr ck_array_buffer 3 ,
|
||||
.Xr ck_array_initialized 3 ,
|
||||
.Xr CK_ARRAY_FOREACH 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
58
doc/ck_bitmap_base
Normal file
58
doc/ck_bitmap_base
Normal file
@ -0,0 +1,58 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_BASE 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_base
|
||||
.Nd determine the size of a bit array in bytes
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft unsigned int
|
||||
.Fn ck_bitmap_base "unsigned int n_bits"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_base
|
||||
function returns the number of bytes that would be used
|
||||
to store the number of bits specified by
|
||||
.Fa n_bits .
|
||||
.Sh RETURN VALUES
|
||||
This function returns a non-zero value that is guaranteed to
|
||||
be a multiple of
|
||||
.Dv sizeof(CK_BITMAP_WORD) .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
56
doc/ck_bitmap_bits
Normal file
56
doc/ck_bitmap_bits
Normal file
@ -0,0 +1,56 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_BITS 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_bits
|
||||
.Nd return number of addressable bits in bitmap
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft unsigned int
|
||||
.Fn ck_bitmap_bits "ck_bitmap_t *bitmap"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_bits
|
||||
function returns the maximum number of addressable bits in
|
||||
the object pointed to by
|
||||
.Fa bitmap .
|
||||
.Sh RETURN VALUES
|
||||
This function returns a non-zero value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
61
doc/ck_bitmap_bts
Normal file
61
doc/ck_bitmap_bts
Normal file
@ -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/
|
65
doc/ck_bitmap_buffer
Normal file
65
doc/ck_bitmap_buffer
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_BUFFER 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_buffer
|
||||
.Nd returns pointer to bit array
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft void *
|
||||
.Fn ck_bitmap_buffer "ck_bitmap_t *bitmap"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_buffer
|
||||
functions returns a pointer to the actual bit array.
|
||||
For ck_bitmap pointers, the bit array is of type
|
||||
CK_BITMAP_WORD[] and consists of
|
||||
ck_bitmap_base(bitmap) / sizeof(CK_BITMAP_WORD) elements.
|
||||
On currently supported 64-bit platforms
|
||||
.Dv CK_BITMAP_WORD
|
||||
is
|
||||
.Dv uint64_t .
|
||||
On currently supported 32-bit platforms
|
||||
.Dv CK_BITMAP_WORD
|
||||
is
|
||||
.Dv uint32_t .
|
||||
.Sh RETURN VALUES
|
||||
This function returns a non-NULL value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_bits 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
56
doc/ck_bitmap_clear
Normal file
56
doc/ck_bitmap_clear
Normal file
@ -0,0 +1,56 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_CLEAR 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_clear
|
||||
.Nd reset all bits
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft void
|
||||
.Fn ck_bitmap_clear "ck_bitmap_t *bitmap"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_clear
|
||||
function sets all bits in the bitmap pointed to by
|
||||
.Fa bitmap
|
||||
to 0.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
84
doc/ck_bitmap_init
Normal file
84
doc/ck_bitmap_init
Normal file
@ -0,0 +1,84 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_init
|
||||
.Nd initialize a bitmap
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft void
|
||||
.Fn ck_bitmap_init "ck_bitmap_t *bitmap" "unsigned int n_bits" "bool set"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_init
|
||||
function initializes the bitmap pointed to by the
|
||||
.Fa bitmap
|
||||
pointer. The argument
|
||||
.Fa n_bits
|
||||
specifies the number of bits that are to be stored in the bitmap.
|
||||
The argument
|
||||
.Fa set
|
||||
determines whether the values of the bits in
|
||||
.Fa bitmap
|
||||
are to be initialized to
|
||||
.Dv 1
|
||||
or
|
||||
.Dv 0 .
|
||||
.Pp
|
||||
It is expected that
|
||||
.Fa bitmap
|
||||
points to a contiguous region of memory containing at least
|
||||
the number of bytes specified by
|
||||
.Xr ck_bitmap_size 3 .
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
.Pp
|
||||
The behavior of
|
||||
.Fn ck_bitmap_init
|
||||
is undefined if
|
||||
.Fa bitmap
|
||||
is not a pointer to a region of bytes
|
||||
of at least
|
||||
.Xr ck_bitmap_size 3
|
||||
length.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
70
doc/ck_bitmap_iterator_init
Normal file
70
doc/ck_bitmap_iterator_init
Normal file
@ -0,0 +1,70 @@
|
||||
.\"
|
||||
.\" Copyright 2012-2013 Samy Al Bahra.
|
||||
.\" Copyright 2012-2013 Shreyas Prasad.
|
||||
.\" 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 April 27, 2012
|
||||
.Dt CK_BITMAP_ITERATOR_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_iterator_init
|
||||
.Nd initialize bitmap iterator
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Pp
|
||||
.Ft void
|
||||
.Fn ck_bitmap_iterator_init "ck_bitmap_iterator_t *iterator" "ck_bitmap_t *bitmap"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_iterator_init
|
||||
function will initialize the object pointed to by
|
||||
the
|
||||
.Fa iterator
|
||||
argument for use with
|
||||
.Fa bitmap .
|
||||
.Pp
|
||||
An iterator is used to iterate through set bitmap bits
|
||||
with the
|
||||
.Xr ck_bitmap_next 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn ck_bitmap_iterator_init
|
||||
function does not return a value.
|
||||
.Sh ERRORS
|
||||
This function will not fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3 ,
|
||||
.Xr ck_bitmap_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
90
doc/ck_bitmap_next
Normal file
90
doc/ck_bitmap_next
Normal file
@ -0,0 +1,90 @@
|
||||
.\"
|
||||
.\" Copyright 2012-2013 Samy Al Bahra.
|
||||
.\" Copyright 2012-2013 Shreyas Prasad.
|
||||
.\" 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 April 27, 2012
|
||||
.Dt CK_BITMAP_TEST 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_next
|
||||
.Nd iterate to the next set bit in bitmap
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft bool
|
||||
.Fn ck_bitmap_next "ck_bitmap_t *bitmap" "ck_bitmap_iterator_t iterator" "unsigned int *bit"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_next
|
||||
function will increment the iterator object pointed to by
|
||||
.Fa iterator
|
||||
to point to the next set bit in the bitmap. If
|
||||
.Fn ck_bitmap_next
|
||||
returns
|
||||
.Dv true
|
||||
then the pointer pointed to by
|
||||
.Fa bit
|
||||
is initialized to the number of the current set bit pointed to by the
|
||||
.Fa iterator
|
||||
object.
|
||||
.Pp
|
||||
It is expected that
|
||||
.Fa iterator
|
||||
has been initialized using the
|
||||
.Xr ck_bitmap_iterator_init 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
If
|
||||
.Fn ck_bitmap_next
|
||||
returns
|
||||
.Dv true
|
||||
then the object pointed to by
|
||||
.Fa bit
|
||||
contains a set bit. If
|
||||
.Fn ck_bitmap_next
|
||||
returns
|
||||
.Dv false
|
||||
then value of the object pointed to by
|
||||
.Fa bit
|
||||
is undefined.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa iterator
|
||||
or
|
||||
.Fa bitmap
|
||||
are uninitialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_reset 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3 ,
|
||||
.Xr ck_bitmap_iterator_init 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
57
doc/ck_bitmap_reset
Normal file
57
doc/ck_bitmap_reset
Normal file
@ -0,0 +1,57 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_RESET 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_reset
|
||||
.Nd resets the bit at the specified index
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft void
|
||||
.Fn ck_bitmap_reset "ck_bitmap_t *bitmap" "unsigned int n"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_reset
|
||||
resets the bit at offset specified by the argument
|
||||
.Fa n
|
||||
to
|
||||
.Dv 0 .
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set 3 ,
|
||||
.Xr ck_bitmap_clear 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
doc/ck_bitmap_set
Normal file
57
doc/ck_bitmap_set
Normal file
@ -0,0 +1,57 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_SET 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_set
|
||||
.Nd set the bit at the specified index
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft void
|
||||
.Fn ck_bitmap_set "ck_bitmap_t *bitmap" "unsigned int n"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_set
|
||||
sets the bit at offset specified by the argument
|
||||
.Fa n
|
||||
to
|
||||
.Dv 1 .
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.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_test 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
62
doc/ck_bitmap_size
Normal file
62
doc/ck_bitmap_size
Normal file
@ -0,0 +1,62 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_SIZE 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_size
|
||||
.Nd returns necessary number of bytes for bitmap
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft unsigned int
|
||||
.Fn ck_bitmap_size "unsigned int n_bits"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_size
|
||||
function returns the number of bytes that are necessary
|
||||
to allocate for a bitmap that will contain the number
|
||||
of bits specified by
|
||||
.Fa n_bits .
|
||||
.Pp
|
||||
This function is used to determine how many bytes to
|
||||
allocate for dynamically created bitmap objects. The
|
||||
allocated object must still be initialized using
|
||||
.Xr ck_bitmap_init 3 .
|
||||
.Sh RETURN VALUES
|
||||
This function returns a non-zero value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set_mpmc 3 ,
|
||||
.Xr ck_bitmap_reset_mpmc 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
62
doc/ck_bitmap_test
Normal file
62
doc/ck_bitmap_test
Normal file
@ -0,0 +1,62 @@
|
||||
.\"
|
||||
.\" 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 April 22, 2012
|
||||
.Dt CK_BITMAP_TEST 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_test
|
||||
.Nd determine if the bit at the specified index is set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft bool
|
||||
.Fn ck_bitmap_test "ck_bitmap_t *bitmap" "unsigned int n"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_test
|
||||
determines if the bit at the offset specified by the argument
|
||||
.Fa n
|
||||
is set to
|
||||
.Dv 1 .
|
||||
.Sh RETURN VALUES
|
||||
This function returns
|
||||
.Dv true
|
||||
if the bit at the specified offset is set to
|
||||
.Dv 1
|
||||
and otherwise returns
|
||||
.Dv false .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bitmap_base 3 ,
|
||||
.Xr ck_bitmap_size 3 ,
|
||||
.Xr ck_bitmap_init 3 ,
|
||||
.Xr ck_bitmap_set_mpmc 3 ,
|
||||
.Xr ck_bitmap_reset_mpmc 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
58
doc/ck_bitmap_union
Normal file
58
doc/ck_bitmap_union
Normal file
@ -0,0 +1,58 @@
|
||||
.\"
|
||||
.\" Copyright 2012-2014 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 February 23, 2013
|
||||
.Dt CK_BITMAP_UNION 3
|
||||
.Sh NAME
|
||||
.Nm ck_bitmap_union
|
||||
.Nd generates union of two bitmaps
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_bitmap.h
|
||||
.Ft void
|
||||
.Fn ck_bitmap_union "ck_bitmap_t *dst" "ck_bitmap_t *src"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_bitmap_union
|
||||
function sets all bits in the bitmap pointed to by
|
||||
.Fa src
|
||||
in the bitmap pointed to by
|
||||
.Fa dst .
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.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_set 3 ,
|
||||
.Xr ck_bitmap_clear 3 ,
|
||||
.Xr ck_bitmap_test 3 ,
|
||||
.Xr ck_bitmap_bits 3 ,
|
||||
.Xr ck_bitmap_buffer 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
121
doc/ck_brlock
Normal file
121
doc/ck_brlock
Normal file
@ -0,0 +1,121 @@
|
||||
.\"
|
||||
.\" 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 26, 2013.
|
||||
.Dt ck_brlock 3
|
||||
.Sh NAME
|
||||
.Nm ck_brlock_init ,
|
||||
.Nm ck_brlock_write_lock ,
|
||||
.Nm ck_brlock_write_unlock ,
|
||||
.Nm ck_brlock_write_trylock ,
|
||||
.Nm ck_brlock_read_register ,
|
||||
.Nm ck_brlock_read_unregister ,
|
||||
.Nm ck_brlock_read_lock ,
|
||||
.Nm ck_brlock_read_trylock ,
|
||||
.Nm ck_brlock_read_unlock
|
||||
.Nd big-reader locks
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_brlock.h
|
||||
.Pp
|
||||
.Dv ck_brlock_t brlock = CK_BRLOCK_INITIALIZER;
|
||||
.Pp
|
||||
.Dv ck_brlock_reader_t reader = CK_BRLOCK_READER_INITIALIZER;
|
||||
.Pp
|
||||
.Ft void
|
||||
.Fn ck_brlock_init "ck_brlock_t *br"
|
||||
.Ft void
|
||||
.Fn ck_brlock_write_lock "ck_brlock_t *br"
|
||||
.Ft void
|
||||
.Fn ck_brlock_write_unlock "ck_brlock_t *br"
|
||||
.Ft bool
|
||||
.Fn ck_brlock_write_trylock "ck_brlock_t *br" "unsigned int factor"
|
||||
.Ft void
|
||||
.Fn ck_brlock_read_register "ck_brlock_t *br" "ck_brlock_reader_t *reader"
|
||||
.Ft void
|
||||
.Fn ck_brlock_read_unregister "ck_brlock_t *br" "ck_brlock_reader_t *reader"
|
||||
.Ft void
|
||||
.Fn ck_brlock_read_lock "ck_brlock_t *br" "ck_brlock_reader_t *reader"
|
||||
.Ft bool
|
||||
.Fn ck_brlock_read_trylock "ck_brlock_t *br" "ck_brlock_reader_t *reader" \
|
||||
"unsigned int factor"
|
||||
.Ft void
|
||||
.Fn ck_brlock_read_unlock "ck_brlock_reader_t *reader"
|
||||
.Sh DESCRIPTION
|
||||
Big reader locks are distributed reader-writer locks with low latency constant time
|
||||
reader acquisition (with respect to number of concurrent readers). On the other
|
||||
hand, writer acquisitions are a relatively expensive O(n) operation. This is a write-biased
|
||||
lock.
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
static ck_brlock_t lock = CK_BRLOCK_INITIALIZER;
|
||||
static __thread ck_brlock_reader_t reader;
|
||||
|
||||
static void
|
||||
reader(void)
|
||||
{
|
||||
|
||||
/* Add our thread as a lock participant. */
|
||||
ck_brlock_read_register(&lock, &reader);
|
||||
|
||||
for (;;) {
|
||||
ck_brlock_read_lock(&lock, &reader);
|
||||
/* Read-side critical section. */
|
||||
ck_brlock_read_unlock(&reader);
|
||||
|
||||
if (ck_brlock_read_trylock(&lock, &reader, 1) == true) {
|
||||
/* Read-side critical section. */
|
||||
ck_brlock_read_unlock(&reader);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
writer(void)
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
ck_brlock_write_lock(&lock);
|
||||
/* Write-side critical section. */
|
||||
ck_brlock_write_unlock(&lock);
|
||||
|
||||
if (ck_brlock_write_trylock(&lock, 1) == true) {
|
||||
/* Write-side critical section. */
|
||||
ck_brlock_write_unlock(&lock);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_bytelock 3 ,
|
||||
.Xr ck_rwlock 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
211
doc/ck_cohort
Normal file
211
doc/ck_cohort
Normal file
@ -0,0 +1,211 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Brendon Scheinman.
|
||||
.\" 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 February 24, 2013.
|
||||
.Dt ck_cohort 3
|
||||
.Sh NAME
|
||||
.Nm ck_cohort
|
||||
.Nd generalized interface for lock cohorts
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_cohort.h
|
||||
.Fn CK_COHORT_PROTOTYPE "COHORT_NAME cohort_name" "LOCK_FXN global_lock_method" \
|
||||
"LOCK_FXN global_unlock_method" "LOCK_FXN local_lock_method" "LOCK_FXN local_unlock_method"
|
||||
.Fn CK_COHORT_TRYLOCK_PROTOTYPE "COHORT_NAME cohort_name" \
|
||||
"LOCK_FXN global_lock_method" "LOCK_FXN global_unlock_method" \
|
||||
"BOOL_LOCK_FXN global_locked_method" "BOOL_LOCK_FXN global_trylock_method" \
|
||||
"LOCK_FXN local_lock_method" "LOCK_FXN local_unlock_method" \
|
||||
"BOOL_LOCK_FXN local_locked_method" "BOOL_LOCK_FXN local_trylock_method"
|
||||
.Fn CK_COHORT_INSTANCE "COHORT_NAME cohort_name"
|
||||
.Fn CK_COHORT_INIT "COHORT_NAME cohort_name" "ck_cohort *cohort" \
|
||||
"void *global_lock" "void *local_lock" "unsigned int pass_limit"
|
||||
.Fn CK_COHORT_LOCK "COHORT_NAME cohort_name" "ck_cohort *cohort" \
|
||||
"void *global_context" "void *local_context"
|
||||
.Fn CK_COHORT_UNLOCK "COHORT_NAME cohort_name" "ck_cohort *cohort" \
|
||||
"void *global_context" "void *local_context"
|
||||
.Pp
|
||||
Where LOCK_FXN refers to a method with the signature
|
||||
.br
|
||||
void(void *lock, void *context)
|
||||
.br
|
||||
BOOL_LOCK_FXN refers to a method with the signature
|
||||
.br
|
||||
bool(void *lock, void *context)
|
||||
.Pp
|
||||
The
|
||||
.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
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
and
|
||||
.Xr CK_COHORT_TRYLOCK 3
|
||||
.
|
||||
.Sh DESCRIPTION
|
||||
ck_cohort.h provides an interface for defining lock cohorts with
|
||||
arbitrary lock types. Cohorts are a mechanism for coordinating
|
||||
threads on NUMA architectures in order to reduce the frequency
|
||||
with which a lock is passed between threads on different clusters.
|
||||
.Pp
|
||||
Before using a cohort, the user must define a cohort type using
|
||||
either the
|
||||
.Fn CK_COHORT_PROTOTYPE
|
||||
or the
|
||||
.Fn CK_COHORT_TRYLOCK_PROTOTYPE
|
||||
macros. These macros allow the user to specify the lock methods that
|
||||
they would like the cohort to use. See the
|
||||
.Xr CK_COHORT_PROTOTYPE 3
|
||||
and
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
|
||||
man pages for more details.
|
||||
.Pp
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <ck_pr.h>
|
||||
#include <ck_cohort.h>
|
||||
#include <ck_spinlock.h>
|
||||
|
||||
/*
|
||||
* Create cohort methods with signatures that match
|
||||
* the required signature
|
||||
*/
|
||||
static void
|
||||
ck_spinlock_lock_with_context(ck_spinlock_t *lock, void *context)
|
||||
{
|
||||
(void)context;
|
||||
ck_spinlock_lock(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
ck_spinlock_unlock_with_context(ck_spinlock_t *lock, void *context)
|
||||
{
|
||||
(void)context;
|
||||
ck_spinlock_unlock(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
static bool
|
||||
ck_spinlock_locked_with_context(ck_spinlock_t *lock, void *context)
|
||||
{
|
||||
(void)context;
|
||||
return ck_spinlock_locked(lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* define a cohort type named "test_cohort" that will use
|
||||
* the above methods for both its global and local locks
|
||||
*/
|
||||
CK_COHORT_PROTOTYPE(test_cohort,
|
||||
ck_spinlock_lock_with_context, ck_spinlock_unlock_with_context, ck_spinlock_locked_with_context,
|
||||
ck_spinlock_lock_with_context, ck_spinlock_unlock_with_context, ck_spinlock_locked_with_context)
|
||||
|
||||
static ck_spinlock_t global_lock = CK_SPINLOCK_INITIALIZER;
|
||||
static unsigned int ready;
|
||||
|
||||
static void *
|
||||
function(void *context)
|
||||
{
|
||||
CK_COHORT_INSTANCE(test_cohort) *cohort = context;
|
||||
|
||||
while (ready == 0);
|
||||
|
||||
while (ready > 0) {
|
||||
/*
|
||||
* acquire the cohort lock before performing critical section.
|
||||
* note that we pass NULL for both the global and local context
|
||||
* arguments because neither the lock nor unlock functions
|
||||
* will use them.
|
||||
*/
|
||||
CK_COHORT_LOCK(test_cohort, cohort, NULL, NULL);
|
||||
|
||||
/* perform critical section */
|
||||
|
||||
/* relinquish cohort lock */
|
||||
CK_COHORT_UNLOCK(test_cohort, cohort, NULL, NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned int nthr = 4;
|
||||
unsigned int n_cohorts = 2;
|
||||
unsigned int i;
|
||||
|
||||
/* allocate 2 cohorts of the defined type */
|
||||
CK_COHORT_INSTANCE(test_cohort) *cohorts =
|
||||
calloc(n_cohorts, sizeof(CK_COHORT_INSTANCE(test_cohort)));
|
||||
|
||||
/* create local locks to use with each cohort */
|
||||
ck_spinlock_t *local_locks =
|
||||
calloc(n_cohorts, sizeof(ck_spinlock_t));
|
||||
|
||||
pthread_t *threads =
|
||||
calloc(nthr, sizeof(pthread_t));
|
||||
|
||||
/* initialize each of the cohorts before using them */
|
||||
for (i = 0 ; i < n_cohorts ; ++i) {
|
||||
CK_COHORT_INIT(test_cohort, cohorts + i, &global_lock, local_locks + i,
|
||||
CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT);
|
||||
}
|
||||
|
||||
/* start each thread and assign cohorts equally */
|
||||
for (i = 0 ; i < nthr ; ++i) {
|
||||
pthread_create(threads + i, NULL, function, cohorts + (i % n_cohorts));
|
||||
}
|
||||
|
||||
ck_pr_store_uint(&ready, 1);
|
||||
sleep(10);
|
||||
ck_pr_store_uint(&ready, 0);
|
||||
|
||||
for (i = 0 ; i < nthr ; ++i) {
|
||||
pthread_join(threads[i], NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr CK_COHORT_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 ,
|
||||
.Xr CK_COHORT_INSTANCE 3 ,
|
||||
.Xr CK_COHORT_INITIALIZER 3 ,
|
||||
.Xr CK_COHORT_INIT 3 ,
|
||||
.Xr CK_COHORT_LOCK 3 ,
|
||||
.Xr CK_COHORT_UNLOCK 3 ,
|
||||
.Xr CK_COHORT_LOCKED 3 ,
|
||||
.Xr CK_COHORT_TRYLOCK 3 ,
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
252
doc/ck_elide
Normal file
252
doc/ck_elide
Normal file
@ -0,0 +1,252 @@
|
||||
.\"
|
||||
.\" 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 13, 2013.
|
||||
.Dt ck_elide 3
|
||||
.Sh NAME
|
||||
.Nm CK_ELIDE_PROTOTYPE ,
|
||||
.Nm CK_ELIDE_LOCK_ADAPTIVE ,
|
||||
.Nm CK_ELIDE_UNLOCK_ADAPTIVE ,
|
||||
.Nm CK_ELIDE_LOCK ,
|
||||
.Nm CK_ELIDE_UNLOCK ,
|
||||
.Nm CK_ELIDE_TRYLOCK_PROTOTYPE ,
|
||||
.Nm CK_ELIDE_TRYLOCK
|
||||
.Nd lock elision wrappers
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_elide.h
|
||||
.Pp
|
||||
.Dv ck_elide_stat_t stat = CK_ELIDE_STAT_INITIALIZER;
|
||||
.Pp
|
||||
.Ft void
|
||||
.Fn ck_elide_stat_init "ck_elide_stat_t *"
|
||||
.Pp
|
||||
.Dv struct ck_elide_config config = CK_ELIDE_CONFIG_DEFAULT_INITIALIZER;
|
||||
.Pp
|
||||
.Bd -literal -offset
|
||||
struct ck_elide_config {
|
||||
unsigned short skip_busy;
|
||||
short retry_busy;
|
||||
unsigned short skip_other;
|
||||
short retry_other;
|
||||
unsigned short skip_conflict;
|
||||
short retry_conflict;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
.Fn CK_ELIDE_PROTOTYPE "NAME" "TYPE" "LOCK_PREDICATE" "LOCK_FUNCTION" "UNLOCK_PREDICATE" "UNLOCK_FUNCTION"
|
||||
.Fn CK_ELIDE_LOCK_ADAPTIVE "NAME" "ck_elide_stat_t *" "struct ck_elide_config *" "TYPE *"
|
||||
.Fn CK_ELIDE_UNLOCK_ADAPTIVE "NAME" "ck_elide_stat_t *" "TYPE *"
|
||||
.Fn CK_ELIDE_LOCK "NAME" "TYPE *"
|
||||
.Fn CK_ELIDE_UNLOCK "NAME" "TYPE *"
|
||||
.Fn CK_ELIDE_TRYLOCK_PROTOTYPE "NAME" "TYPE" "LOCK_PREDICATE" "TRYLOCK_FUNCTION"
|
||||
.Sh DESCRIPTION
|
||||
These macros implement lock elision wrappers for a user-specified single-argument
|
||||
lock interface. The wrappers will attempt to elide lock acquisition, allowing
|
||||
concurrent execution of critical sections that do not issue conflicting memory
|
||||
operations. If any threads have successfully elided a lock acquisition,
|
||||
conflicting memory operations will roll-back any side-effects of the critical
|
||||
section and force every thread to retry the lock acquisition regularly.
|
||||
.Pp
|
||||
.Fn CK_ELIDE_LOCK ,
|
||||
.Fn CK_ELIDE_UNLOCK ,
|
||||
.Fn CK_ELIDE_LOCK_ADAPTIVE ,
|
||||
and
|
||||
.Fn CK_ELIDE_UNLOCK_ADAPTIVE
|
||||
macros require
|
||||
a previous
|
||||
.Fn CK_ELIDE_PROTOTYPE
|
||||
with the same
|
||||
.Fa NAME .
|
||||
Elision is attempted if the
|
||||
.Fa LOCK_PREDICATE
|
||||
function returns false. If
|
||||
.Fa LOCK_PREDICATE
|
||||
returns true then elision is aborted and
|
||||
.Fa LOCK_FUNCTION
|
||||
is executed instead. If any threads are in an elided critical section,
|
||||
.Fa LOCK_FUNCTION
|
||||
must force them to rollback through a conflicting memory operation.
|
||||
The
|
||||
.Fa UNLOCK_PREDICATE
|
||||
function must return true if the lock is acquired by the caller, meaning
|
||||
that the lock was not successfully elided. If
|
||||
.Fa UNLOCK_PREDICATE
|
||||
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
|
||||
.Fn CK_ELIDE_LOCK_ADAPTIVE
|
||||
will immediately call
|
||||
.Fn LOCK_FUNCTION .
|
||||
.Fn CK_ELIDE_UNLOCK
|
||||
and
|
||||
.Fn CK_ELIDE_UNLOCK_ADAPTIVE
|
||||
will immediately call
|
||||
.Fn UNLOCK_FUNCTION .
|
||||
.Pp
|
||||
.Fn CK_ELIDE_TRYLOCK
|
||||
requires a previous
|
||||
.Fn CK_ELIDE_TRYLOCK_PROTOTYPE
|
||||
with the same name.
|
||||
Elision is attempted if the
|
||||
.Fa LOCK_PREDICATE
|
||||
function returns false. If
|
||||
.Fa LOCK_PREDICATE
|
||||
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
|
||||
will immediately call
|
||||
.Fn TRYLOCK_FUNCTION .
|
||||
.Pp
|
||||
.Fn CK_ELIDE_LOCK_ADAPTIVE
|
||||
and
|
||||
.Fn CK_ELIDE_UNLOCK_ADAPTIVE
|
||||
will adapt the elision behavior associated with lock operations
|
||||
according to the run-time behavior of the program. This behavior
|
||||
is defined by the ck_elide_config structure pointer passed to
|
||||
.Fn CK_ELIDE_LOCK_ADAPTIVE .
|
||||
A thread-local ck_elide_stat structure must be passed to both
|
||||
.Fn CK_ELIDE_LOCK_ADAPTIVE
|
||||
and
|
||||
.Fn CK_ELIDE_UNLOCK_ADAPTIVE .
|
||||
This structure is expected to be unique for different workloads,
|
||||
may not be re-used in recursive acquisitions and must match the
|
||||
lifetime of the lock it is associated with. It is safe to mix
|
||||
adaptive calls with best-effort calls.
|
||||
.Pp
|
||||
Both ck_spinlock.h and ck_rwlock.h define ck_elide wrappers under
|
||||
the ck_spinlock and ck_rwlock namespace, respectively.
|
||||
.Sh EXAMPLES
|
||||
This example utilizes built-in lock elision facilities in ck_rwlock and ck_spinlock.
|
||||
.Bd -literal -offset indent
|
||||
#include <ck_rwlock.h>
|
||||
#include <ck_spinlock.h>
|
||||
|
||||
static ck_rwlock_t rw = CK_RWLOCK_INITIALIZER;
|
||||
static struct ck_elide_config rw_config =
|
||||
CK_ELIDE_CONFIG_DEFAULT_INITIALIZER;
|
||||
static __thread ck_elide_stat_t rw_stat =
|
||||
CK_ELIDE_STAT_INITIALIZER;
|
||||
|
||||
static ck_spinlock_t spinlock = CK_SPINLOCK_INITIALIZER;
|
||||
static struct ck_elide_config spinlock_config =
|
||||
CK_ELIDE_CONFIG_DEFAULT_INITIALIZER;
|
||||
static __thread ck_elide_stat_t spinlock_stat =
|
||||
CK_ELIDE_STAT_INITIALIZER;
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
|
||||
/* Lock-unlock write-side lock in weak best-effort manner. */
|
||||
CK_ELIDE_LOCK(ck_rwlock_write, &rw);
|
||||
CK_ELIDE_UNLOCK(ck_rwlock_write, &rw);
|
||||
|
||||
/* Attempt to acquire the write-side lock. */
|
||||
if (CK_ELIDE_TRYLOCK(ck_rwlock_write, &rw) == true)
|
||||
CK_ELIDE_UNLOCK(ck_rwlock_write, &rw);
|
||||
|
||||
/* Lock-unlock read-side lock in weak best-effort manner. */
|
||||
CK_ELIDE_LOCK(ck_rwlock_read, &rw);
|
||||
CK_ELIDE_UNLOCK(ck_rwlock_read, &rw);
|
||||
|
||||
/* Attempt to acquire the read-side lock. */
|
||||
if (CK_ELIDE_TRYLOCK(ck_rwlock_read, &rw) == true)
|
||||
CK_ELIDE_UNLOCK(ck_rwlock_read, &rw);
|
||||
|
||||
/* Lock-unlock write-side lock in an adaptive manner. */
|
||||
CK_ELIDE_LOCK_ADAPTIVE(ck_rwlock_write, &rw_stat,
|
||||
&rw_config, &rw);
|
||||
CK_ELIDE_UNLOCK_ADAPTIVE(ck_rwlock_write, &rw_stat,
|
||||
&rw_config, &rw);
|
||||
|
||||
/* Lock-unlock read-side lock in an adaptive manner. */
|
||||
CK_ELIDE_LOCK_ADAPTIVE(ck_rwlock_read, &rw_stat,
|
||||
&rw_config, &rw);
|
||||
CK_ELIDE_UNLOCK_ADAPTIVE(ck_rwlock_read, &rw_stat,
|
||||
&rw_config, &rw);
|
||||
|
||||
/* Lock-unlock spinlock in weak best-effort manner. */
|
||||
CK_ELIDE_LOCK(ck_spinlock, &spinlock);
|
||||
CK_ELIDE_UNLOCK(ck_spinlock, &spinlock);
|
||||
|
||||
/* Attempt to acquire the lock. */
|
||||
if (CK_ELIDE_TRYLOCK(ck_spinlock, &lock) == true)
|
||||
CK_ELIDE_UNLOCK(ck_spinlock, &spinlock);
|
||||
|
||||
/* Lock-unlock spinlock in an adaptive manner. */
|
||||
CK_ELIDE_LOCK_ADAPTIVE(ck_spinlock, &spinlock_stat,
|
||||
&spinlock_config, &spinlock);
|
||||
CK_ELIDE_UNLOCK_ADAPTIVE(ck_spinlock, &spinlock_stat,
|
||||
&spinlock_config, &spinlock);
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
In this example, user-defined locking functions are provided an elision
|
||||
implementation.
|
||||
.Bd -literal -offset indent
|
||||
/* Assume lock_t has been previously defined. */
|
||||
#include <ck_elide.h>
|
||||
|
||||
/*
|
||||
* This function returns true if the lock is unavailable at the time
|
||||
* it was called or false if the lock is available.
|
||||
*/
|
||||
bool is_locked(lock_t *);
|
||||
|
||||
/*
|
||||
* This function acquires the supplied lock.
|
||||
*/
|
||||
void lock(lock_t *);
|
||||
|
||||
/*
|
||||
* This function releases the lock.
|
||||
*/
|
||||
void unlock(lock_t *);
|
||||
|
||||
CK_ELIDE_PROTOTYPE(my_lock, lock_t, is_locked, lock, is_locked, unlock)
|
||||
|
||||
static lock_t lock;
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
|
||||
CK_ELIDE_LOCK(my_lock, &lock);
|
||||
CK_ELIDE_UNLOCK(my_lock, &lock);
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_rwlock 3 ,
|
||||
.Xr ck_spinlock 3
|
||||
.Pp
|
||||
Ravi Rajwar and James R. Goodman. 2001. Speculative lock elision: enabling highly concurrent multithreaded execution. In Proceedings of the 34th annual ACM/IEEE international symposium on Microarchitecture (MICRO 34). IEEE Computer Society, Washington, DC, USA, 294-305.
|
||||
.Pp
|
||||
Additional information available at http://en.wikipedia.org/wiki/Transactional_Synchronization_Extensions and http://concurrencykit.org/
|
120
doc/ck_epoch_barrier
Normal file
120
doc/ck_epoch_barrier
Normal file
@ -0,0 +1,120 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_BARRIER 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_barrier
|
||||
.Nd block until a grace period and all callbacks have been dispatched
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_barrier "ck_epoch_record_t *record"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_barrier 3
|
||||
function will block the caller until a grace period has been
|
||||
detected, according to the semantics of epoch reclamation.
|
||||
Any objects requiring safe memory reclamation which are logically
|
||||
deleted are safe for physical deletion following a call to
|
||||
.Fn ck_epoch_barrier 3 . This function will also dispatch all callbacks
|
||||
associated with
|
||||
.Fa epoch
|
||||
that were previously scheduled via
|
||||
.Fn ck_epoch_call 3 .
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
|
||||
#include <ck_epoch.h>
|
||||
#include <ck_stack.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* epoch was previously initialized with ck_epoch_init.
|
||||
* stack was previously initialized with ck_stack_init.
|
||||
*/
|
||||
ck_epoch_t *epoch;
|
||||
ck_stack_t *stack;
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
ck_epoch_record_t *record;
|
||||
ck_stack_entry_t *s;
|
||||
|
||||
record = malloc(sizeof *record);
|
||||
ck_epoch_register(&epoch, record);
|
||||
|
||||
/*
|
||||
* We are using an epoch section here to guarantee no
|
||||
* nodes in the stack are deleted while we are dereferencing
|
||||
* them. This is needed here because there are multiple writers.
|
||||
* If there was only one thread popping from the this stack,
|
||||
* then there is no need to ck_epoch_begin/ck_epoch_end.
|
||||
*/
|
||||
ck_epoch_begin(record);
|
||||
|
||||
/* Logically delete an object. */
|
||||
s = ck_stack_pop_upmc(stack);
|
||||
|
||||
ck_epoch_end(record);
|
||||
|
||||
/*
|
||||
* Wait until no threads could possibly have a reference to the
|
||||
* object we just popped (assume all threads are simply executing
|
||||
* ck_stack_pop_upmc).
|
||||
*/
|
||||
ck_epoch_barrier(record);
|
||||
|
||||
/* It is now safe to physically delete the object. */
|
||||
free(s);
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if the object pointed to by
|
||||
.Fa epoch
|
||||
is not a valid epoch object. The object pointed to by
|
||||
.Fa record
|
||||
must have been previously registered via
|
||||
.Fn ck_epoch_register 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
73
doc/ck_epoch_begin
Normal file
73
doc/ck_epoch_begin
Normal file
@ -0,0 +1,73 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_BEGIN 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_begin
|
||||
.Nd begin epoch-protected segment of execution
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_begin "ck_epoch_record_t *record" "ck_epoch_section_t *section"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_begin 3
|
||||
function will mark the beginning of an epoch-protected code section.
|
||||
An epoch-protected code section is delimited by a call to the
|
||||
.Fn ck_epoch_end 3
|
||||
function. Though recursion is allowed for epoch-protected sections,
|
||||
recursive calls will be associated with the
|
||||
.Fn ck_epoch_begin 3
|
||||
that is at the top of the call stack. If a section is passed, then
|
||||
recursion on a record will cause the epoch to be refreshed on entry
|
||||
of every protected section.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
The object pointed to by
|
||||
.Fa epoch
|
||||
must have been previously initiated via
|
||||
.Fn ck_epoch_init 3 .
|
||||
The object pointed to by
|
||||
.Fa record
|
||||
must have been previously registered via
|
||||
.Fn ck_epoch_register 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
136
doc/ck_epoch_call
Normal file
136
doc/ck_epoch_call
Normal file
@ -0,0 +1,136 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_CALL 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_call
|
||||
.Nd defer function execution until a grace period
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
typedef struct ck_epoch_entry ck_epoch_entry_t;
|
||||
.br
|
||||
typedef void ck_epoch_cb_t(ck_epoch_entry_t *);
|
||||
.Ft void
|
||||
.Fn ck_epoch_call "ck_epoch_record_t *record" "ck_epoch_entry_t *entry" "ck_epoch_cb_t *function"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_call 3
|
||||
function will defer the execution of the function pointed to by
|
||||
.Fa function
|
||||
until a grace-period has been detected in
|
||||
.Fa epoch .
|
||||
The function will be provided
|
||||
the pointer specified by
|
||||
.Fa entry .
|
||||
The function will execute at some time in the future via calls to
|
||||
.Fn ck_epoch_reclaim 3 ,
|
||||
.Fn ck_epoch_barrier 3
|
||||
or
|
||||
.Fn ck_epoch_poll 3 .
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
|
||||
#include <ck_epoch.h>
|
||||
#include <ck_stack.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* epoch was previously initialized with ck_epoch_init.
|
||||
*/
|
||||
ck_epoch_t *epoch;
|
||||
|
||||
struct object {
|
||||
int value;
|
||||
ck_epoch_entry_t epoch_entry;
|
||||
};
|
||||
static struct object *global;
|
||||
|
||||
CK_EPOCH_CONTAINER(struct object, epoch_entry, object_container)
|
||||
|
||||
void
|
||||
destroy_object(ck_epoch_entry_t *e)
|
||||
{
|
||||
struct object *o = object_container(e);
|
||||
|
||||
free(o);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
ck_epoch_record_t *record;
|
||||
struct object *n;
|
||||
|
||||
record = malloc(sizeof *record);
|
||||
ck_epoch_register(&epoch, record);
|
||||
|
||||
n = malloc(sizeof *n);
|
||||
if (n == NULL)
|
||||
return;
|
||||
|
||||
n->value = 1;
|
||||
|
||||
/*
|
||||
* We are using an epoch section here because there are multiple
|
||||
* writers. It is also an option to use other forms of blocking
|
||||
* write-side synchronization such as mutexes.
|
||||
*/
|
||||
ck_epoch_begin(record);
|
||||
n = ck_pr_fas_ptr(&global, n);
|
||||
ck_epoch_end(record);
|
||||
|
||||
/* Defer destruction of previous object. */
|
||||
ck_epoch_call(record, &n->epoch_entry, destroy_object);
|
||||
|
||||
/* Poll epoch sub-system in non-blocking manner. */
|
||||
ck_epoch_poll(record);
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
The object pointed to by
|
||||
.Fa record
|
||||
must have been previously registered via
|
||||
.Fn ck_epoch_register 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
64
doc/ck_epoch_end
Normal file
64
doc/ck_epoch_end
Normal file
@ -0,0 +1,64 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_END 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_end
|
||||
.Nd end epoch-protected segment of execution
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_end "ck_epoch_record_t *record" "ck_epoch_section_t *section"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_end 3
|
||||
function will mark the end of an epoch-protected code section.
|
||||
.Fa section
|
||||
must point to a section object initialized previously with
|
||||
.Fn ck_epoch_begin 3 .
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
The object pointed to by
|
||||
.Fa record
|
||||
must have been previously registered via
|
||||
.Fn ck_epoch_register 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
69
doc/ck_epoch_init
Normal file
69
doc/ck_epoch_init
Normal file
@ -0,0 +1,69 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_init
|
||||
.Nd initialize epoch reclamation object
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_init "ck_epoch_t *epoch"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_init
|
||||
function initializes the epoch object pointed to by the
|
||||
.Fa epoch
|
||||
pointer.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
.Pp
|
||||
The behavior of
|
||||
.Fn ck_epoch_init
|
||||
is undefined if
|
||||
.Fa epoch
|
||||
is not a pointer to a
|
||||
.Tn ck_epoch_t
|
||||
object.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
71
doc/ck_epoch_poll
Normal file
71
doc/ck_epoch_poll
Normal file
@ -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 September 2, 2012
|
||||
.Dt CK_EPOCH_POLL 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_poll
|
||||
.Nd non-blocking poll of epoch object for dispatch cycles
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft bool
|
||||
.Fn ck_epoch_poll "ck_epoch_record_t *record"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_poll 3
|
||||
function will attempt to dispatch any functions associated with the
|
||||
object pointed to by
|
||||
.Fa epoch
|
||||
via
|
||||
.Fn ck_epoch_call 3
|
||||
if deemed safe. This function is meant to be used in cases epoch
|
||||
reclamation cost must be amortized over time in a manner that does
|
||||
not affect caller progress.
|
||||
.Sh RETURN VALUES
|
||||
This function will return true if at least one function was dispatched.
|
||||
This function will return false if it has determined not all threads have
|
||||
observed the latest generation of epoch-protected objects. Neither value
|
||||
indicates an error.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if the object pointed to by
|
||||
.Fa record
|
||||
has not have been previously registered via
|
||||
.Fn ck_epoch_register 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
92
doc/ck_epoch_reclaim
Normal file
92
doc/ck_epoch_reclaim
Normal file
@ -0,0 +1,92 @@
|
||||
.\"
|
||||
.\" 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 May 2, 2013
|
||||
.Dt CK_EPOCH_RECLAIM 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_reclaim
|
||||
.Nd immediately execute all deferred callbacks
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_reclaim "ck_epoch_record_t *record"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_reclaim 3
|
||||
function will unconditionally execute all callbacks
|
||||
that have been deferred with
|
||||
.Fn ck_epoch_call 3 .
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
|
||||
#include <ck_epoch.h>
|
||||
#include <ck_stack.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* epoch was previously initialized with ck_epoch_init.
|
||||
*/
|
||||
ck_epoch_t *epoch;
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
ck_epoch_record_t *record;
|
||||
|
||||
logically_delete(object);
|
||||
ck_epoch_call(epoch, record, &object->epoch_entry, destructor);
|
||||
|
||||
/*
|
||||
* Wait until no threads could possibly have a reference to the
|
||||
* object we just deleted.
|
||||
*/
|
||||
ck_epoch_synchronize(epoch, record);
|
||||
|
||||
/*
|
||||
* Execute all deferred callbacks.
|
||||
*/
|
||||
ck_epoch_reclaim(record);
|
||||
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
102
doc/ck_epoch_recycle
Normal file
102
doc/ck_epoch_recycle
Normal file
@ -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 2, 2012
|
||||
.Dt CK_EPOCH_RECYCLE 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_recycle
|
||||
.Nd return an epoch record that may be used by caller
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft ck_epoch_record_t *
|
||||
.Fn ck_epoch_recycle "ck_epoch_t *epoch"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_recycle 3
|
||||
function attempts to return an unused epoch record object for use by
|
||||
the caller. These epoch records were associated with previous calls
|
||||
to the
|
||||
.Fn ck_epoch_unregister 3
|
||||
function.
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
#include <ck_epoch.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* epoch was previously initialized with ck_epoch_init.
|
||||
*/
|
||||
ck_epoch_t *epoch;
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
ck_epoch_record_t *record;
|
||||
|
||||
record = ck_epoch_recycle(&epoch);
|
||||
if (record == NULL) {
|
||||
record = malloc(sizeof *record);
|
||||
if (record == NULL)
|
||||
return;
|
||||
|
||||
ck_epoch_register(&epoch, record);
|
||||
}
|
||||
|
||||
/*
|
||||
* After we are done, we will unregister the record so it
|
||||
* can be used by other new participants in the epoch system
|
||||
* provided by the object pointed to by "epoch".
|
||||
*/
|
||||
ck_epoch_unregister(&epoch, record);
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
This function returns a pointer to a
|
||||
.Dv ck_epoch_record_t
|
||||
object. If no unused record was found to be associated with the
|
||||
object pointed to by
|
||||
.Fa epoch ,
|
||||
then the function will return NULL.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if the object pointed to by
|
||||
.Fa epoch
|
||||
is not a valid epoch object.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
67
doc/ck_epoch_register
Normal file
67
doc/ck_epoch_register
Normal file
@ -0,0 +1,67 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_REGISTER 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_register
|
||||
.Nd register a thread for epoch reclamation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_register "ck_epoch_t *epoch" "ck_epoch_record_t *record"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_register 3
|
||||
function associates a record object specified by the
|
||||
.Fa record
|
||||
pointer with the epoch object pointed to by
|
||||
.Fa epoch .
|
||||
Any thread or processor that will require safe memory reclamation
|
||||
guarantees must register a unique record object. After registration, the
|
||||
object pointed to by the
|
||||
.Fa record
|
||||
argument will have lifetime managed by the underlying epoch sub-system.
|
||||
The record object must not be destroyed after it is associated with a
|
||||
.Fn ck_epoch_register 3
|
||||
call.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
119
doc/ck_epoch_synchronize
Normal file
119
doc/ck_epoch_synchronize
Normal file
@ -0,0 +1,119 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_SYNCHRONIZE 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_synchronize
|
||||
.Nd block until a grace period has been detected
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_synchronize "ck_epoch_record_t *record"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_synchronize 3
|
||||
function will block the caller until a grace period has been
|
||||
detected, according to the semantics of epoch reclamation.
|
||||
Any objects requiring safe memory reclamation which are logically
|
||||
deleted are safe for physical deletion following a call to
|
||||
.Fn ck_epoch_synchronize 3 .
|
||||
If you require that all callbacks be dispatched, then it is suggested
|
||||
that you use
|
||||
.Fn ck_epoch_barrier 3
|
||||
instead or follow a call of
|
||||
.Fn ck_epoch_synchronize 3
|
||||
with
|
||||
.Fn ck_epoch_reclaim 3 .
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
|
||||
#include <ck_epoch.h>
|
||||
#include <ck_stack.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* epoch was previously initialized with ck_epoch_init.
|
||||
* stack was previously initialized with ck_stack_init.
|
||||
*/
|
||||
ck_epoch_t *epoch;
|
||||
ck_stack_t *stack;
|
||||
|
||||
void
|
||||
function(void)
|
||||
{
|
||||
ck_epoch_record_t *record;
|
||||
ck_stack_entry_t *s;
|
||||
|
||||
record = malloc(sizeof *record);
|
||||
ck_epoch_register(&epoch, record);
|
||||
|
||||
/*
|
||||
* We are using an epoch section here to guarantee no
|
||||
* nodes in the stack are deleted while we are dereferencing
|
||||
* them. This is needed here because there are multiple writers.
|
||||
* If there was only one thread popping from the this stack,
|
||||
* then there is no need to ck_epoch_begin/ck_epoch_end.
|
||||
*/
|
||||
ck_epoch_begin(record);
|
||||
|
||||
/* Logically delete an object. */
|
||||
s = ck_stack_pop_upmc(stack);
|
||||
|
||||
ck_epoch_end(record);
|
||||
|
||||
/*
|
||||
* Wait until no threads could possibly have a reference to the
|
||||
* object we just popped (assume all threads are simply executing
|
||||
* ck_stack_pop_upmc).
|
||||
*/
|
||||
ck_epoch_synchronize(record);
|
||||
|
||||
/* It is now safe to physically delete the object. */
|
||||
free(s);
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh ERRORS
|
||||
The object pointed to by .Fa record must have been previously registered via
|
||||
.Fn ck_epoch_register 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_unregister 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
65
doc/ck_epoch_unregister
Normal file
65
doc/ck_epoch_unregister
Normal file
@ -0,0 +1,65 @@
|
||||
.\"
|
||||
.\" 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 2, 2012
|
||||
.Dt CK_EPOCH_UNREGISTER 3
|
||||
.Sh NAME
|
||||
.Nm ck_epoch_unregister
|
||||
.Nd unregister a thread for epoch reclamation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_epoch.h
|
||||
.Ft void
|
||||
.Fn ck_epoch_unregister "ck_epoch_record_t *record"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_epoch_unregister 3
|
||||
function allows for the record pointed by the
|
||||
.Fa record
|
||||
pointer to be used as a return value by the
|
||||
.Fn ck_epoch_recycle 3
|
||||
function. This record can now be used by another thread
|
||||
of execution. Behavior is undefined if the object pointed by
|
||||
.Fa record
|
||||
is modified in any way, even after a call is made to the
|
||||
.Fn ck_epoch_unregister 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_epoch_init 3 ,
|
||||
.Xr ck_epoch_register 3 ,
|
||||
.Xr ck_epoch_recycle 3 ,
|
||||
.Xr ck_epoch_poll 3 ,
|
||||
.Xr ck_epoch_synchronize 3 ,
|
||||
.Xr ck_epoch_reclaim 3 ,
|
||||
.Xr ck_epoch_barrier 3 ,
|
||||
.Xr ck_epoch_call 3 ,
|
||||
.Xr ck_epoch_begin 3 ,
|
||||
.Xr ck_epoch_end 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
86
doc/ck_hs_apply
Normal file
86
doc/ck_hs_apply
Normal file
@ -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/
|
70
doc/ck_hs_count
Normal file
70
doc/ck_hs_count
Normal file
@ -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_HS_COUNT 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_count
|
||||
.Nd returns number of entries in hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft unsigned long
|
||||
.Fn ck_hs_count "ck_hs_t *hs"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_remove 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_rebuild 3 ,
|
||||
.Xr ck_hs_gc 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/
|
77
doc/ck_hs_destroy
Normal file
77
doc/ck_hs_destroy
Normal file
@ -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_HS_DESTROY 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_destroy
|
||||
.Nd destroy hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft void
|
||||
.Fn ck_hs_destroy "ck_hs_t *hs"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_destroy 3
|
||||
function will request that the underlying allocator, as specified by the
|
||||
.Xr ck_hs_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_hs_destroy 3
|
||||
is called.
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_hs_destroy 3
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
This function is guaranteed not to fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_hs_init 3 ,
|
||||
.Xr ck_hs_move 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_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
98
doc/ck_hs_fas
Normal file
98
doc/ck_hs_fas
Normal file
@ -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_HS_FAS 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_fas
|
||||
.Nd fetch and store key in hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_fas "ck_hs_t *hs" "unsigned long hash" "const void *key" "void **previous"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_HASH 3
|
||||
macro).
|
||||
.Pp
|
||||
If the call to
|
||||
.Fn ck_hs_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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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/
|
88
doc/ck_hs_gc
Normal file
88
doc/ck_hs_gc
Normal file
@ -0,0 +1,88 @@
|
||||
.\"
|
||||
.\" 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_HS_GC 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_gc
|
||||
.Nd perform maintenance on a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_gc "ck_hs_t *hs" "unsigned long cycles" "unsigned long seed"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_gc 3
|
||||
function will perform various maintenance routines on the hash set
|
||||
pointed to by
|
||||
.Fa hs ,
|
||||
including defragmentation of probe sequences with respect to tombstones
|
||||
and in the case that the delete workload hint has been passed, recalculation
|
||||
of probe sequence bounds. The
|
||||
.Fa cycles
|
||||
argument is used to indicate how many hash set entries should be subject
|
||||
to attempted maintenance. If
|
||||
.Fa cycles
|
||||
is 0, then maintenance is performed on the complete hash set. The
|
||||
.Fa seed
|
||||
argument determines the start location of the maintenance process. If
|
||||
.Fa cycles
|
||||
is non-zero, it is recommended that
|
||||
.Fa seed
|
||||
is some random value. If the delete hint has been passed, the function
|
||||
will require an additional 12% of memory (with respect to existing
|
||||
memory usage of the set), until operation completion.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion,
|
||||
.Fn ck_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_grow 3 ,
|
||||
.Xr ck_hs_rebuild 3 ,
|
||||
.Xr ck_hs_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_remove 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/
|
88
doc/ck_hs_get
Normal file
88
doc/ck_hs_get
Normal file
@ -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_HS_GET 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_get
|
||||
.Nd load a key from a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft void *
|
||||
.Fn ck_hs_get "ck_hs_t *hs" "unsigned long hash" "const void *key"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 3 ,
|
||||
.Xr CK_HS_HASH 3 ,
|
||||
.Xr ck_hs_iterator_init 3 ,
|
||||
.Xr ck_hs_next 3 ,
|
||||
.Xr ck_hs_put 3 ,
|
||||
.Xr ck_hs_put_unique 3 ,
|
||||
.Xr ck_hs_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
81
doc/ck_hs_grow
Normal file
81
doc/ck_hs_grow
Normal file
@ -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_HS_GROW 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_grow
|
||||
.Nd enlarge hash set capacity
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_grow "ck_hs_t *hs" "unsigned long capacity"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs 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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_remove 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/
|
169
doc/ck_hs_init
Normal file
169
doc/ck_hs_init
Normal file
@ -0,0 +1,169 @@
|
||||
.\"
|
||||
.\" 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_HS_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_init
|
||||
.Nd initialize a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft typedef unsigned long
|
||||
.Fn ck_hs_hash_cb_t "const void *key" "unsigned long seed"
|
||||
.Ft typedef bool
|
||||
.Fn ck_hs_compare_cb_t "const void *c1" "const void *c2"
|
||||
.Ft bool
|
||||
.Fn ck_hs_init "ck_hs_t *hs" "unsigned int mode" "ck_hs_hash_cb_t *hash_function" "ck_hs_compare_cb_t *compare" "struct ck_malloc *allocator" "unsigned long capacity" "unsigned long seed"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_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_HS_MODE_DIRECT
|
||||
The hash set is meant to directly store key values and that all
|
||||
bits of the key are used to encode values.
|
||||
.El
|
||||
.Pp
|
||||
The concurrent access model is specified by:
|
||||
.Bl -tag -width indent
|
||||
.It CK_HS_MODE_SPMC
|
||||
The hash set should allow for concurrent readers in the
|
||||
presence of a single writer.
|
||||
.It CK_HS_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
|
||||
.It CK_HS_MODE_DELETE
|
||||
The hash set is expected to have a delete-heavy workload.
|
||||
At the cost of approximately 13% increased memory usage,
|
||||
allow for stronger per-slot probe bounds to combat the
|
||||
effects of tombstone accumulation.
|
||||
.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_hs_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_hs_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_hs_init
|
||||
is undefined if
|
||||
.Fa hs
|
||||
is not a pointer to a
|
||||
.Tn ck_hs_t
|
||||
object.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
78
doc/ck_hs_iterator_init
Normal file
78
doc/ck_hs_iterator_init
Normal file
@ -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_HS_ITERATOR_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_iterator_init
|
||||
.Nd initialize hash set iterator
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Pp
|
||||
.Dv ck_hs_iterator_t iterator = CK_HS_ITERATOR_INITIALIZER
|
||||
.Pp
|
||||
.Ft void
|
||||
.Fn ck_hs_iterator_init "ck_hs_iterator_t *iterator"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_ITERATOR_INITIALIZER value.
|
||||
.Pp
|
||||
An iterator is used to iterate through hash set entries with the
|
||||
.Xr ck_hs_next 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_hs_iterator_init 3
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
This function will not fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 3 ,
|
||||
.Xr CK_HS_HASH 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_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
90
doc/ck_hs_move
Normal file
90
doc/ck_hs_move
Normal file
@ -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_HS_MOVE 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_move
|
||||
.Nd move one from hash set to another
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_move "ck_hs_t *destination" "ck_hs_t *source" "ck_hs_hash_cb_t *hash_cb" "ck_hs_compare_cb_t *compare_cb" "struct ck_malloc *m"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs_get 3
|
||||
and
|
||||
.Xr ck_hs_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_hs_move 3
|
||||
returns true and otherwise returns false to indicate an error.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_hs_init 3 ,
|
||||
.Xr ck_hs_destroy 3 ,
|
||||
.Xr CK_HS_HASH 3 ,
|
||||
.Xr ck_hs_iterator_init 3 ,
|
||||
.Xr ck_hs_next 3 ,
|
||||
.Xr ck_hs_put 3 ,
|
||||
.Xr ck_hs_put_unique 3 ,
|
||||
.Xr ck_hs_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
92
doc/ck_hs_next
Normal file
92
doc/ck_hs_next
Normal file
@ -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_HS_NEXT 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_next
|
||||
.Nd iterate to next entry in hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_next "ck_hs_t *hs" "ck_hs_iterator_t *iterator" "void **entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs_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_hs_iterator_init 3
|
||||
function or statically initialized using CK_HS_ITERATOR_INITIALIZER.
|
||||
.Sh RETURN VALUES
|
||||
If
|
||||
.Fn ck_hs_next 3
|
||||
returns true then the object pointed to by
|
||||
.Fa entry
|
||||
points to a valid hash set key. If
|
||||
.Fn ck_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 3 ,
|
||||
.Xr CK_HS_HASH 3 ,
|
||||
.Xr ck_hs_iterator_init 3 ,
|
||||
.Xr ck_hs_get 3 ,
|
||||
.Xr ck_hs_put 3 ,
|
||||
.Xr ck_hs_put_unique 3 ,
|
||||
.Xr ck_hs_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
98
doc/ck_hs_put
Normal file
98
doc/ck_hs_put
Normal file
@ -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_HS_PUT 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_put
|
||||
.Nd store unique key into a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_put "ck_hs_t *hs" "unsigned long hash" "const void *key"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_HASH 3
|
||||
macro).
|
||||
.Pp
|
||||
If the call to
|
||||
.Fn ck_hs_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_hs_set 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion,
|
||||
.Fn ck_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 3 ,
|
||||
.Xr CK_HS_HASH 3 ,
|
||||
.Xr ck_hs_iterator_init 3 ,
|
||||
.Xr ck_hs_next 3 ,
|
||||
.Xr ck_hs_put_unique 3 ,
|
||||
.Xr ck_hs_get 3 ,
|
||||
.Xr ck_hs_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
98
doc/ck_hs_put_unique
Normal file
98
doc/ck_hs_put_unique
Normal file
@ -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_HS_PUT_UNIQUE 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_put_unique
|
||||
.Nd unconditionally store unique key into a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_put_unique "ck_hs_t *hs" "unsigned long hash" "const void *key"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_HASH 3
|
||||
macro).
|
||||
.Pp
|
||||
If the call to
|
||||
.Fn ck_hs_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_hs_set 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion,
|
||||
.Fn ck_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 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/
|
76
doc/ck_hs_rebuild
Normal file
76
doc/ck_hs_rebuild
Normal file
@ -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_HS_REBUILD 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_rebuild
|
||||
.Nd rebuild a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_rebuild "ck_hs_t *hs"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_gc 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_remove 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/
|
92
doc/ck_hs_remove
Normal file
92
doc/ck_hs_remove
Normal file
@ -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_HS_REMOVE 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_remove
|
||||
.Nd remove key from a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft void *
|
||||
.Fn ck_hs_remove "ck_hs_t *hs" "unsigned long hash" "const void *key"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_HASH 3
|
||||
macro).
|
||||
.Pp
|
||||
If the call to
|
||||
.Fn ck_hs_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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_gc 3 ,
|
||||
.Xr ck_hs_rebuild 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/
|
77
doc/ck_hs_reset
Normal file
77
doc/ck_hs_reset
Normal file
@ -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_HS_RESET 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_reset
|
||||
.Nd remove all keys from a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_reset "ck_hs_t *hs"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_remove 3 ,
|
||||
.Xr ck_hs_reset_size 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_gc 3 ,
|
||||
.Xr ck_hs_rebuild 3 ,
|
||||
.Xr ck_hs_count 3 ,
|
||||
.Xr ck_hs_stat 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
80
doc/ck_hs_reset_size
Normal file
80
doc/ck_hs_reset_size
Normal file
@ -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_HS_RESET_SIZE 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_reset_size
|
||||
.Nd remove all keys from a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_reset_size "ck_hs_t *hs" "unsigned long size"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_remove 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_gc 3 ,
|
||||
.Xr ck_hs_rebuild 3 ,
|
||||
.Xr ck_hs_count 3 ,
|
||||
.Xr ck_hs_reset 3 ,
|
||||
.Xr ck_hs_stat 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
102
doc/ck_hs_set
Normal file
102
doc/ck_hs_set
Normal file
@ -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_HS_SET 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_set
|
||||
.Nd store key into a hash set
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft bool
|
||||
.Fn ck_hs_set "ck_hs_t *hs" "unsigned long hash" "const void *key" "void **previous"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_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_HS_HASH 3
|
||||
macro).
|
||||
.Pp
|
||||
If the call to
|
||||
.Fn ck_hs_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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_fas 3 ,
|
||||
.Xr ck_hs_remove 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_gc 3 ,
|
||||
.Xr ck_hs_rebuild 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/
|
81
doc/ck_hs_stat
Normal file
81
doc/ck_hs_stat
Normal file
@ -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_HS_STAT 3
|
||||
.Sh NAME
|
||||
.Nm ck_hs_stat
|
||||
.Nd get hash set status
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_hs.h
|
||||
.Ft void
|
||||
.Fn ck_hs_stat "ck_hs_t *hs" "struct ck_hs_stat *st"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_hs_stat 3
|
||||
function will store various hash set statistics in
|
||||
the object pointed to by
|
||||
.Fa st .
|
||||
The ck_hs_stat structure is defined as follows:
|
||||
.Bd -literal -offset indent
|
||||
struct ck_hs_stat {
|
||||
unsigned long tombstones; /* Current number of tombstones in hash set. */
|
||||
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_hs_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_hs_init 3 ,
|
||||
.Xr ck_hs_move 3 ,
|
||||
.Xr ck_hs_destroy 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_set 3 ,
|
||||
.Xr ck_hs_fas 3 ,
|
||||
.Xr ck_hs_remove 3 ,
|
||||
.Xr ck_hs_grow 3 ,
|
||||
.Xr ck_hs_gc 3 ,
|
||||
.Xr ck_hs_rebuild 3 ,
|
||||
.Xr ck_hs_count 3 ,
|
||||
.Xr ck_hs_reset 3 ,
|
||||
.Xr ck_hs_reset_size 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
77
doc/ck_ht_count
Normal file
77
doc/ck_ht_count
Normal file
@ -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 March 29, 2012
|
||||
.Dt CK_HT_COUNT 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_count
|
||||
.Nd return count of key-value pairs in hash table
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft uint64_t
|
||||
.Fn ck_ht_count "ck_ht_t *ht"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_count
|
||||
function will return the number of entries in the hash table
|
||||
pointed to be the
|
||||
.Fa ht
|
||||
argument. The function may only be called without the presence
|
||||
of concurrent write operations.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa ht
|
||||
has not been initialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
87
doc/ck_ht_destroy
Normal file
87
doc/ck_ht_destroy
Normal file
@ -0,0 +1,87 @@
|
||||
.\"
|
||||
.\" 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 29, 2012
|
||||
.Dt CK_HT_DESTROY 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_destroy
|
||||
.Nd immediately destroy a hash table
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void
|
||||
.Fn ck_ht_destroy "ck_ht_t *ht"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_destroy
|
||||
function will request that the underlying allocator, as specified by the
|
||||
.Xr ck_ht_init 3
|
||||
function, immediately destroy the object pointed to by the
|
||||
.Fa ht
|
||||
argument.
|
||||
.Pp
|
||||
The user must guarantee that no threads are accessing the object pointed to
|
||||
by
|
||||
.Fa ht
|
||||
when
|
||||
.Fn ck_ht_destroy
|
||||
is called.
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_destroy
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
This function is guaranteed not to fail.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
90
doc/ck_ht_entry_empty
Normal file
90
doc/ck_ht_entry_empty
Normal file
@ -0,0 +1,90 @@
|
||||
.\"
|
||||
.\" 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 29, 2012
|
||||
.Dt CK_HT_ENTRY_EMPTY 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_empty
|
||||
.Nd determine whether entry contains a key-value pair
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft bool
|
||||
.Fn ck_ht_entry_empty "ck_ht_entry_t *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_empty
|
||||
function will return
|
||||
.Dv false
|
||||
if
|
||||
.Fa entry
|
||||
points to a valid key-value pair. If
|
||||
.Fa entry
|
||||
does not point to a valid key-value pair it
|
||||
returns
|
||||
.Dv true.
|
||||
It is expected that the object pointed to by
|
||||
.Fa entry
|
||||
was initialized by a preceding call to the
|
||||
.Xr ck_ht_entry_set
|
||||
family of functions, the
|
||||
.Xr ck_ht_get_spmc 3
|
||||
function or the
|
||||
.Xr ck_ht_set_spmc 3
|
||||
function.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa entry
|
||||
has not been initialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
88
doc/ck_ht_entry_key
Normal file
88
doc/ck_ht_entry_key
Normal file
@ -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 March 30, 2012
|
||||
.Dt CK_HT_ENTRY_KEY 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_key
|
||||
.Nd return pointer to key as specified in hash table entry
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void *
|
||||
.Fn ck_ht_entry_key "ck_ht_entry_t *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_key
|
||||
function will return the key pointer as specified in the
|
||||
object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Pp
|
||||
It is expected that the entry is
|
||||
associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_BYTESTRING
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_key
|
||||
returns
|
||||
.Dv NULL
|
||||
if the entry is empty.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa entry
|
||||
has not been initialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
91
doc/ck_ht_entry_key_direct
Normal file
91
doc/ck_ht_entry_key_direct
Normal file
@ -0,0 +1,91 @@
|
||||
.\"
|
||||
.\" 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 30, 2012
|
||||
.Dt CK_HT_ENTRY_KEY_DIRECT 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_key_direct
|
||||
.Nd return key value as specified in hash table entry
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft uintptr_t
|
||||
.Fn ck_ht_entry_key_direct "ck_ht_entry_t *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_key_direct
|
||||
function will return the key value as specified in the
|
||||
object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Pp
|
||||
It is expected that the entry is
|
||||
associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_DIRECT
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_key_direct
|
||||
returns
|
||||
.Dv 0
|
||||
if the entry is empty. Otherwise, it returns the
|
||||
key value stored in the object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa entry
|
||||
has not been initialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
88
doc/ck_ht_entry_key_length
Normal file
88
doc/ck_ht_entry_key_length
Normal file
@ -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 March 30, 2012
|
||||
.Dt CK_HT_ENTRY_KEY_LENGTH 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_key_length
|
||||
.Nd returns the length of the key specified in the argument
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft uint16_t
|
||||
.Fn ck_ht_entry_key_length "ck_ht_entry_t *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_key_length
|
||||
function will return the length of the key associated with the
|
||||
object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Pp
|
||||
It is expected that the entry is
|
||||
associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_BYTESTRING
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_key_length
|
||||
returns
|
||||
.Dv 0
|
||||
if the entry is empty.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa entry
|
||||
has not been initialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
93
doc/ck_ht_entry_key_set
Normal file
93
doc/ck_ht_entry_key_set
Normal file
@ -0,0 +1,93 @@
|
||||
.\"
|
||||
.\" 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 30, 2012
|
||||
.Dt CK_HT_ENTRY_KEY_SET 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_key_set
|
||||
.Nd initialize pointer to key in hash table entry
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void
|
||||
.Fn ck_ht_entry_key_set "ck_ht_entry_t *entry" "const void *key" "uint16_t key_length"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_key_set
|
||||
function will initialize the object pointed to by
|
||||
.Fa entry
|
||||
with a key pointed to by the
|
||||
.Fa key
|
||||
argument. The length of the key is specified by
|
||||
.Fa key_length.
|
||||
The maximum value of
|
||||
.Fa key_length
|
||||
is defined by the CK_HT_KEY_LENGTH macro.
|
||||
This function is typically used to initialize an
|
||||
entry for
|
||||
.Xr ck_ht_get_spmc 3
|
||||
and
|
||||
.Xr ck_ht_remove_spmc 3
|
||||
operations. It is expected that the entry will
|
||||
be associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_BYTESTRING
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_key_set
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
This function will never fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
88
doc/ck_ht_entry_key_set_direct
Normal file
88
doc/ck_ht_entry_key_set_direct
Normal file
@ -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 March 30, 2012
|
||||
.Dt CK_HT_ENTRY_KEY_SET_DIRECT 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_key_set_direct
|
||||
.Nd initialize key value in hash table entry
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void
|
||||
.Fn ck_ht_entry_key_set_direct "ck_ht_entry_t *entry" "uintptr_t key"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_key_set_direct
|
||||
function will initialize the object pointed to by
|
||||
.Fa entry
|
||||
with the key value specified in the
|
||||
.Fa key
|
||||
argument. This function is typically used to initialize an
|
||||
entry for
|
||||
.Xr ck_ht_get_spmc 3
|
||||
and
|
||||
.Xr ck_ht_remove_spmc 3
|
||||
operations. It is expected that the entry will
|
||||
be associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_DIRECT
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_key_set_direct
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
This function will never fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
95
doc/ck_ht_entry_set
Normal file
95
doc/ck_ht_entry_set
Normal file
@ -0,0 +1,95 @@
|
||||
.\"
|
||||
.\" 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 30, 2012
|
||||
.Dt CK_HT_ENTRY_SET 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_set
|
||||
.Nd initialize a key-value pair
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void
|
||||
.Fn ck_ht_entry_set "ck_ht_entry_t *entry" "ck_ht_hash_t h" "const void *key" "uint16_t key_length" "const void *value"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_set
|
||||
function will initialize the object pointed to by
|
||||
.Fa entry
|
||||
with a key pointed to by the
|
||||
.Fa key
|
||||
argument and a value pointed to by the
|
||||
.Fa value
|
||||
argument. The length of the key is specified by
|
||||
.Fa key_length.
|
||||
The maximum value of
|
||||
.Fa key_length
|
||||
is defined by the CK_HT_KEY_LENGTH macro.
|
||||
This function is typically used to initialize an
|
||||
entry for
|
||||
.Xr ck_ht_set_spmc 3
|
||||
and
|
||||
.Xr ck_ht_put_spmc 3
|
||||
operations. It is expected that the entry will
|
||||
be associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_BYTESTRING
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_set
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
This function will never fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
94
doc/ck_ht_entry_set_direct
Normal file
94
doc/ck_ht_entry_set_direct
Normal file
@ -0,0 +1,94 @@
|
||||
.\"
|
||||
.\" 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 30, 2012
|
||||
.Dt CK_HT_ENTRY_SET_DIRECT 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_set_direct
|
||||
.Nd initialize a key-value pair
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void
|
||||
.Fn ck_ht_entry_set_direct "ck_ht_entry_t *entry" "ck_ht_hash_t h" "uintptr_t key" "uintptr_t value"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_set
|
||||
function will initialize the object pointed to by
|
||||
.Fa entry
|
||||
with the hash value specified by the
|
||||
.Fa h
|
||||
argument, the key value specified in the
|
||||
.Fa key
|
||||
argument and the value specified by the
|
||||
.Fa value
|
||||
argument.
|
||||
.Pp
|
||||
This function is typically used to initialize an
|
||||
entry for
|
||||
.Xr ck_ht_set_spmc 3
|
||||
and
|
||||
.Xr ck_ht_put_spmc 3
|
||||
operations. It is expected that the entry will
|
||||
be associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_DIRECT
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
.Fn ck_ht_entry_set_direct
|
||||
has no return value.
|
||||
.Sh ERRORS
|
||||
This function will never fail.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
88
doc/ck_ht_entry_value
Normal file
88
doc/ck_ht_entry_value
Normal file
@ -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 March 30, 2012
|
||||
.Dt CK_HT_ENTRY_VALUE 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_value
|
||||
.Nd return pointer to value as specified in hash table entry
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft void *
|
||||
.Fn ck_ht_entry_value "ck_ht_entry_t *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_value
|
||||
function will return the value pointer as specified in the
|
||||
object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Pp
|
||||
It is expected that the entry is
|
||||
associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_BYTESTRING
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn ck_ht_entry_value
|
||||
function returns the value pointed to by
|
||||
.Dv entry.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa entry
|
||||
has not been initialized or if the key is empty.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value_direct 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
89
doc/ck_ht_entry_value_direct
Normal file
89
doc/ck_ht_entry_value_direct
Normal file
@ -0,0 +1,89 @@
|
||||
.\"
|
||||
.\" 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 30, 2012
|
||||
.Dt CK_HT_ENTRY_VALUE_DIRECT 3
|
||||
.Sh NAME
|
||||
.Nm ck_ht_entry_value_direct
|
||||
.Nd return value as specified in hash table entry
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ht.h
|
||||
.Ft uintptr_t
|
||||
.Fn ck_ht_entry_value_direct "ck_ht_entry_t *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ht_entry_value_direct
|
||||
function will return the value of the key-value pair as specified in the
|
||||
object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Pp
|
||||
It is expected that the entry is
|
||||
associated with a hash table initialized with
|
||||
.Dv CK_HT_MODE_DIRECT
|
||||
(see
|
||||
.Xr ck_ht_init 3
|
||||
for more information).
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn ck_ht_entry_value_direct
|
||||
function returns the value stored in the object pointed to by the
|
||||
.Fa entry
|
||||
argument.
|
||||
.Sh ERRORS
|
||||
Behavior is undefined if
|
||||
.Fa entry
|
||||
has not been initialized or if the key is empty.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ht_stat 3 ,
|
||||
.Xr ck_ht_init 3 ,
|
||||
.Xr ck_ht_destroy 3 ,
|
||||
.Xr ck_ht_hash 3 ,
|
||||
.Xr ck_ht_hash_direct 3 ,
|
||||
.Xr ck_ht_set_spmc 3 ,
|
||||
.Xr ck_ht_put_spmc 3 ,
|
||||
.Xr ck_ht_gc 3 ,
|
||||
.Xr ck_ht_get_spmc 3 ,
|
||||
.Xr ck_ht_grow_spmc 3 ,
|
||||
.Xr ck_ht_remove_spmc 3 ,
|
||||
.Xr ck_ht_count 3 ,
|
||||
.Xr ck_ht_reset_spmc 3 ,
|
||||
.Xr ck_ht_reset_size_spmc 3 ,
|
||||
.Xr ck_ht_entry_empty 3 ,
|
||||
.Xr ck_ht_entry_key_set 3 ,
|
||||
.Xr ck_ht_entry_key_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_length 3 ,
|
||||
.Xr ck_ht_entry_key 3 ,
|
||||
.Xr ck_ht_entry_set 3 ,
|
||||
.Xr ck_ht_entry_set_direct 3 ,
|
||||
.Xr ck_ht_entry_key_direct 3 ,
|
||||
.Xr ck_ht_entry_value 3 ,
|
||||
.Xr ck_ht_iterator_init 3 ,
|
||||
.Xr ck_ht_next 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user