ck_pring
Brendon Scheinman 12 years ago
commit c5934b47ae

2
configure vendored

@ -33,7 +33,7 @@ EXIT_FAILURE=1
P_PWD=`pwd`
MAINTAINER='sbahra@repnop.org'
VERSION=${VERSION:-'0.2.17'}
VERSION=${VERSION:-'0.2.18'}
VERSION_MAJOR='0'
BUILD="$PWD/build/ck.build"
PREFIX=${PREFIX:-"/usr/local"}

@ -17,6 +17,7 @@ OBJECTS=ck_ht_count \
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 \
@ -50,6 +51,7 @@ OBJECTS=ck_ht_count \
ck_epoch_poll \
ck_epoch_recycle \
ck_epoch_register \
ck_epoch_reclaim \
ck_epoch_synchronize \
ck_epoch_unregister \
ck_bag_allocator_set \
@ -76,6 +78,7 @@ OBJECTS=ck_ht_count \
ck_hs_grow \
ck_hs_count \
ck_hs_reset \
ck_hs_reset_size \
ck_hs_stat \
ck_cohort \
CK_COHORT_PROTOTYPE \
@ -116,7 +119,9 @@ OBJECTS=ck_ht_count \
ck_ring_trydequeue_spmc \
ck_ring_dequeue_spsc \
ck_ring_enqueue_spsc \
ck_ring_enqueue_spsc_size
ck_ring_enqueue_spsc_size \
ck_ring_size \
ck_ring_capacity
all:
for target in $(OBJECTS); do \

@ -112,6 +112,7 @@ must have been previously registered via
.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

@ -63,6 +63,7 @@ must have been previously registered via
.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

@ -48,7 +48,7 @@ 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_synchronize 3 ,
.Fn ck_epoch_reclaim 3 ,
.Fn ck_epoch_barrier 3
or
.Fn ck_epoch_poll 3 .
@ -127,6 +127,7 @@ must have been previously registered via
.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

@ -57,6 +57,7 @@ must have been previously registered via
.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

@ -60,6 +60,7 @@ object.
.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 ,

@ -64,6 +64,7 @@ must have been previously registered via
.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 ,

@ -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/

@ -93,6 +93,7 @@ is not a valid epoch object.
.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 ,

@ -58,6 +58,7 @@ This function has no return value.
.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 ,

@ -42,15 +42,14 @@ 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 . This function may also dispatch callbacks
associated with
.Fa epoch
that were previously scheduled via
.Fn ck_epoch_call 3 .
.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.
instead or follow a call of
.Fn ck_epoch_synchronize 3
with
.Fn ck_epoch_reclaim 3 .
.Sh EXAMPLE
.Bd -literal -offset indent
@ -115,6 +114,7 @@ must have been previously registered via
.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 ,

@ -64,6 +64,7 @@ function.
.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 ,

@ -59,6 +59,7 @@ thread.
.Xr ck_hs_remove 3 ,
.Xr ck_hs_grow 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/

@ -66,6 +66,7 @@ This function is guaranteed not to fail.
.Xr ck_hs_grow 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,6 +77,7 @@ are uninitialized.
.Xr ck_hs_grow 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,6 +70,7 @@ failures.
.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/

@ -148,6 +148,7 @@ object.
.Xr ck_hs_grow 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/

@ -67,6 +67,7 @@ This function will not fail.
.Xr ck_hs_grow 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,6 +81,7 @@ are uninitialized.
.Xr ck_hs_grow 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/

@ -87,6 +87,7 @@ to accomodate key insertion.
.Xr ck_hs_grow 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,6 +81,7 @@ are uninitialized.
.Xr ck_hs_grow 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/

@ -64,6 +64,7 @@ thread.
.Xr ck_hs_put 3 ,
.Xr ck_hs_set 3 ,
.Xr ck_hs_remove 3 ,
.Xr ck_hs_reset_size 3 ,
.Xr ck_hs_grow 3 ,
.Xr ck_hs_count 3 ,
.Xr ck_hs_stat 3

@ -0,0 +1,75 @@
.\"
.\" 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_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_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/

@ -91,6 +91,7 @@ to accomodate key insertion.
.Xr ck_hs_grow 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,6 +70,7 @@ thread.
.Xr ck_hs_remove 3 ,
.Xr ck_hs_grow 3 ,
.Xr ck_hs_count 3 ,
.Xr ck_hs_reset 3
.Xr ck_hs_reset 3 ,
.Xr ck_hs_reset_size 3
.Pp
Additional information available at http://concurrencykit.org/

@ -58,7 +58,8 @@ has not been initialized.
.Xr ck_ht_get_spmc 3 ,
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_reset 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 ,

@ -68,6 +68,7 @@ This function is guaranteed not to fail.
.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 ,

@ -72,7 +72,8 @@ has not been initialized.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -70,7 +70,8 @@ has not been initialized.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -73,7 +73,8 @@ has not been initialized.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -70,7 +70,8 @@ has not been initialized.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -75,7 +75,8 @@ This function will never fail.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -70,7 +70,8 @@ This function will never fail.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -77,7 +77,8 @@ This function will never fail.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -76,7 +76,8 @@ This function will never fail.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -70,7 +70,8 @@ has not been initialized or if the key is empty.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -71,7 +71,8 @@ has not been initialized or if the key is empty.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -158,6 +158,7 @@ was not found in the hash table.
.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 ,

@ -79,6 +79,7 @@ if there are internal memory allocation failures.
.Xr ck_ht_get_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 ,

@ -71,6 +71,7 @@ is uninitialized.
.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 ,

@ -71,6 +71,7 @@ is uninitialized.
.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 ,

@ -164,6 +164,7 @@ object.
.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 ,

@ -71,7 +71,7 @@ This function will not fail.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -89,7 +89,8 @@ are uninitialized.
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_count 3 ,
.Xr ck_ht_reset 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 ,

@ -127,6 +127,7 @@ was already present in the hash table.
.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 ,

@ -98,6 +98,7 @@ will return
.Xr ck_ht_get_spmc 3 ,
.Xr ck_ht_grow_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 ,

@ -0,0 +1,83 @@
.\"
.\" 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_HT_RESET_SPMC 3
.Sh NAME
.Nm ck_ht_reset_size_spmc
.Nd remove all entries from a hash table and reset size
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_ht.h
.Ft bool
.Fn ck_ht_reset_size_spmc "ck_ht_t *ht" "uint64_t capacity"
.Sh DESCRIPTION
The
.Fn ck_ht_reset_size_spmc
function will remove all key-value pairs stored in the hash
table pointed to by the
.Fa ht
argument and create a new generation of the hash table that
is preallocated for
.Fa capacity
entries.
.Sh RETURN VALUES
If successful,
.Fn ck_ht_reset_size_spmc
will return
.Dv true
and will otherwise return
.Dv false.
This function will only fail if a replacement hash table
could not be allocated internally.
.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_get_spmc 3 ,
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_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_reset_spmc 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/

@ -62,6 +62,7 @@ could not be allocated internally.
.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_count 3 ,
.Xr ck_ht_entry_empty 3 ,
.Xr ck_ht_entry_key_set 3 ,

@ -121,6 +121,7 @@ while attempting to grow.
.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 ,

@ -66,7 +66,8 @@ has not been initialized.
.Xr ck_ht_get_spmc 3 ,
.Xr ck_ht_grow_spmc 3 ,
.Xr ck_ht_remove_spmc 3 ,
.Xr ck_ht_reset 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 ,

@ -0,0 +1,55 @@
.\"
.\" 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 20, 2013
.Dt CK_RING_CAPACITY 3
.Sh NAME
.Nm ck_ring_capacity
.Nd returns number of pointer slots in bounded FIFO
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_ring.h
.Ft unsigned int
.Fn ck_ring_capacity "ck_ring_t *ring"
.Sh DESCRIPTION
The
.Fn ck_ring_capacity 3
function returns the number of pointers that can be
held in the buffer pointed to by
.Fa ring .
.Sh SEE ALSO
.Xr ck_ring_init 3 ,
.Xr ck_ring_enqueue_spmc 3 ,
.Xr ck_ring_dequeue_spmc 3 ,
.Xr ck_ring_trydequeue_spmc 3 ,
.Xr ck_ring_enqueue_spmc_size 3 ,
.Xr ck_ring_dequeue_spsc 3 ,
.Xr ck_ring_enqueue_spsc 3 ,
.Xr ck_ring_enqueue_spsc_size 3 ,
.Xr ck_ring_size 3
.Pp
Additional information available at http://concurrencykit.org/

@ -0,0 +1,55 @@
.\"
.\" 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 20, 2013
.Dt CK_RING_SIZE 3
.Sh NAME
.Nm ck_ring_size
.Nd return number of pointers enqueued in bounded FIFO
.Sh LIBRARY
Concurrency Kit (libck, \-lck)
.Sh SYNOPSIS
.In ck_ring.h
.Ft unsigned int
.Fn ck_ring_size "ck_ring_t *ring"
.Sh DESCRIPTION
The
.Fn ck_ring_size 3
function returns the number of pointers currently
enqueued in the buffer pointed to by
.Fa ring .
.Sh SEE ALSO
.Xr ck_ring_init 3 ,
.Xr ck_ring_enqueue_spmc 3 ,
.Xr ck_ring_dequeue_spmc 3 ,
.Xr ck_ring_trydequeue_spmc 3 ,
.Xr ck_ring_enqueue_spmc_size 3 ,
.Xr ck_ring_dequeue_spsc 3 ,
.Xr ck_ring_enqueue_spsc 3 ,
.Xr ck_ring_enqueue_spsc_size 3 ,
.Xr ck_ring_capacity 3
.Pp
Additional information available at http://concurrencykit.org/

@ -151,5 +151,6 @@ void ck_epoch_unregister(ck_epoch_t *, ck_epoch_record_t *);
bool ck_epoch_poll(ck_epoch_t *, ck_epoch_record_t *);
void ck_epoch_synchronize(ck_epoch_t *, ck_epoch_record_t *);
void ck_epoch_barrier(ck_epoch_t *, ck_epoch_record_t *);
void ck_epoch_reclaim(ck_epoch_record_t *);
#endif /* _CK_EPOCH_H */

@ -98,6 +98,7 @@ void *ck_hs_remove(ck_hs_t *, unsigned long, const void *);
bool ck_hs_grow(ck_hs_t *, unsigned long);
unsigned long ck_hs_count(ck_hs_t *);
bool ck_hs_reset(ck_hs_t *);
bool ck_hs_reset_size(ck_hs_t *, unsigned long);
void ck_hs_stat(ck_hs_t *, struct ck_hs_stat *);
#endif /* _CK_HS_H */

@ -253,6 +253,7 @@ bool ck_ht_get_spmc(ck_ht_t *, ck_ht_hash_t, ck_ht_entry_t *);
bool ck_ht_grow_spmc(ck_ht_t *, uint64_t);
bool ck_ht_remove_spmc(ck_ht_t *, ck_ht_hash_t, ck_ht_entry_t *);
bool ck_ht_reset_spmc(ck_ht_t *);
bool ck_ht_reset_size_spmc(ck_ht_t *, uint64_t);
uint64_t ck_ht_count(ck_ht_t *);
#endif /* CK_F_PR_LOAD_64 && CK_F_PR_STORE_64 */

@ -197,7 +197,7 @@ write_thread(void *unused CK_CC_UNUSED)
}
}
ck_epoch_synchronize(&stack_epoch, &record);
ck_epoch_barrier(&stack_epoch, &record);
if (tid == 0) {
fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b[W] Peak: %u (%2.2f%%)\n Reclamations: %lu\n\n",

@ -192,7 +192,12 @@ write_thread(void *unused CK_CC_UNUSED)
e = stack_container(s);
ck_epoch_end(&stack_epoch, &record);
ck_epoch_synchronize(&stack_epoch, &record);
if (i & 1) {
ck_epoch_synchronize(&stack_epoch, &record);
ck_epoch_reclaim(&record);
} else {
ck_epoch_barrier(&stack_epoch, &record);
}
if (i & 1) {
ck_epoch_call(&stack_epoch, &record, &e->epoch_entry, destructor);

@ -124,7 +124,7 @@ thread(void *unused CK_CC_UNUSED)
record.n_pending,
record.n_dispatch);
ck_epoch_synchronize(&stack_epoch, &record);
ck_epoch_barrier(&stack_epoch, &record);
ck_pr_inc_uint(&e_barrier);
while (ck_pr_load_uint(&e_barrier) < (n_threads << 1));

@ -1,6 +1,6 @@
/*
* Copyrighs 2012 Samy Al Bahra.
* All righss reserved.
* Copyright 2012 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

@ -1,6 +1,6 @@
/*
* Copyrighs 2012 Samy Al Bahra.
* All righss reserved.
* Copyright 2012 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

@ -1,5 +1,5 @@
/*
* Copyrighs 2012 Samy Al Bahra.
* Copyright 2012 Samy Al Bahra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

@ -42,7 +42,7 @@
#if defined(_WIN32)
#include <assert.h>
#include <time.h>
#define NOMINMAX
#include <windows.h>
#define DELTA_EPOCH 11644473600000000ULL
#else

@ -275,11 +275,25 @@ ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e)
return;
}
/*
* Reclaim all objects associated with a record.
*/
void
ck_epoch_reclaim(struct ck_epoch_record *record)
{
unsigned int epoch;
for (epoch = 0; epoch < CK_EPOCH_LENGTH; epoch++)
ck_epoch_dispatch(record, epoch);
return;
}
/*
* This function must not be called with-in read section.
*/
void
ck_epoch_barrier(struct ck_epoch *global, struct ck_epoch_record *record)
ck_epoch_synchronize(struct ck_epoch *global, struct ck_epoch_record *record)
{
struct ck_epoch_record *cr;
unsigned int delta, epoch, goal, i;
@ -322,7 +336,7 @@ ck_epoch_barrier(struct ck_epoch *global, struct ck_epoch_record *record)
* we are at a grace period.
*/
if (active == false)
goto dispatch;
goto leave;
/*
* Increment current epoch. CAS semantics are used to eliminate
@ -349,7 +363,7 @@ reload:
* generation. We can actually avoid an addtional scan step
* at this point.
*/
goto dispatch;
goto leave;
}
}
@ -376,26 +390,17 @@ reload:
break;
}
/*
* As the synchronize operation is non-blocking, it is possible other
* writers have already observed three or more epoch generations
* relative to the generation the caller has observed. In this case,
* it is safe to assume we are also in a grace period and are able to
* dispatch all calls across all lists.
*/
dispatch:
for (epoch = 0; epoch < CK_EPOCH_LENGTH; epoch++)
ck_epoch_dispatch(record, epoch);
leave:
record->epoch = delta;
return;
}
void
ck_epoch_synchronize(struct ck_epoch *global, struct ck_epoch_record *record)
ck_epoch_barrier(struct ck_epoch *global, struct ck_epoch_record *record)
{
ck_epoch_barrier(global, record);
ck_epoch_synchronize(global, record);
ck_epoch_reclaim(record);
return;
}

@ -167,12 +167,12 @@ ck_hs_map_create(struct ck_hs *hs, unsigned long entries)
}
bool
ck_hs_reset(struct ck_hs *hs)
ck_hs_reset_size(struct ck_hs *hs, unsigned long capacity)
{
struct ck_hs_map *map, *previous;
previous = hs->map;
map = ck_hs_map_create(hs, previous->capacity);
map = ck_hs_map_create(hs, capacity);
if (map == NULL)
return false;
@ -181,6 +181,15 @@ ck_hs_reset(struct ck_hs *hs)
return true;
}
bool
ck_hs_reset(struct ck_hs *hs)
{
struct ck_hs_map *previous;
previous = hs->map;
return ck_hs_reset_size(hs, previous->capacity);
}
static inline unsigned long
ck_hs_map_probe_next(struct ck_hs_map *map,
unsigned long offset,

@ -453,12 +453,12 @@ ck_ht_next(struct ck_ht *table,
}
bool
ck_ht_reset_spmc(struct ck_ht *table)
ck_ht_reset_size_spmc(struct ck_ht *table, uint64_t size)
{
struct ck_ht_map *map, *update;
map = table->map;
update = ck_ht_map_create(table, map->capacity);
update = ck_ht_map_create(table, size);
if (update == NULL)
return false;
@ -467,6 +467,14 @@ ck_ht_reset_spmc(struct ck_ht *table)
return true;
}
bool
ck_ht_reset_spmc(struct ck_ht *table)
{
struct ck_ht_map *map = table->map;
return ck_ht_reset_size_spmc(table, map->capacity);
}
bool
ck_ht_grow_spmc(ck_ht_t *table, uint64_t capacity)
{

Loading…
Cancel
Save