diff --git a/doc/ck_bag_allocator_set b/doc/ck_bag_allocator_set new file mode 100644 index 0000000..00fb9a7 --- /dev/null +++ b/doc/ck_bag_allocator_set @@ -0,0 +1,64 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_ALLOCATOR_SET +.Sh NAME +.Nm ck_bag_allocator_set +.Nd specify ck_bag memory allocation functions +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_allocator_set "struct ck_malloc *m, size_t alloc_overhead" +.Sh DESCRIPTION +The +.Fn ck_bag_allocator_set +function initializes the memory allocation functions used by the ck_bag +implementation according to the function pointers specified by the structure +pointed to by the +.Fa allocator +argument. it is mandatory that this function is called before any other ck_bag operations. +.Sh RETURN VALUES +.Fn ck_bag_allocator_set +returns a value of true, otherwise returns a value of false to indicate failure. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_block_count b/doc/ck_bag_block_count new file mode 100644 index 0000000..286053f --- /dev/null +++ b/doc/ck_bag_block_count @@ -0,0 +1,63 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_BLOCK_COUNT 3 +.Sh NAME +.Nm ck_bag_block_count +.Nd determine the number of entries in a ck_bag_block +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft uint16_t +.Fn ck_bag_block_count "struct ck_bag_block *block" +.Sh DESCRIPTION +The +.Fn ck_bag_block_count +function will return the number of entries in a ck_bag_block pointed to by the +.Fa block +argument. +.Sh ERRORS +Behavior is undefined if the ck_bag pointed to by the +.Fa bag +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_block_next b/doc/ck_bag_block_next new file mode 100644 index 0000000..ecb3495 --- /dev/null +++ b/doc/ck_bag_block_next @@ -0,0 +1,65 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_BLOCK_NEXT 3 +.Sh NAME +.Nm ck_bag_block_next +.Nd extract next pointer from a ck_bag_block +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft struct ck_bag_block * +.Fn ck_bag_block_next "struct ck_bag_block *block" +.Sh DESCRIPTION +The +.Fn ck_bag_block_next +function will return the next pointer extracted from the +.Fa block +argument. On x86_64 platforms, both the number of entries and the next pointer +are stored within a single pointer. For all other platforms, this should be considered +an empty operation. +.Sh ERRORS +Behavior is undefined if +.Fa block +has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_count b/doc/ck_bag_count new file mode 100644 index 0000000..90c56fd --- /dev/null +++ b/doc/ck_bag_count @@ -0,0 +1,63 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_COUNT 3 +.Sh NAME +.Nm ck_bag_count +.Nd determine number of entries in a ck_bag +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft unsigned int +.Fn ck_bag_count "struct ck_bag *bag" +.Sh DESCRIPTION +The +.Fn ck_bag_count +function will return the number of entries in a ck_bag pointed to by the +.Fa bag +argument. +.Sh ERRORS +Behavior is undefined if the ck_bag pointed to by the +.Fa bag +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_destroy b/doc/ck_bag_destroy new file mode 100644 index 0000000..c8de786 --- /dev/null +++ b/doc/ck_bag_destroy @@ -0,0 +1,68 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_DESTROY 3 +.Sh NAME +.Nm ck_bag_destroy +.Nd destroy a ck_bag +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft void +.Fn ck_bag_destroy "struct ck_bag *bag" +.Sh DESCRIPTION +The +.Fn ck_bag_destroy +function will request the underlying allocator, associated with the ck_bag, +to immediately destroy the ck_bag pointed to by the +.Fa bag +argument +.Pp +The user must guarantee that no other threads are accessing the object pointed to by the +.Fa bag +argument when +.Fn ck_bag_destroy +is called. +.Sh ERRORS +This function will not fail. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_init b/doc/ck_bag_init new file mode 100644 index 0000000..3392038 --- /dev/null +++ b/doc/ck_bag_init @@ -0,0 +1,88 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_INIT 3 +.Sh NAME +.Nm ck_bag_init +.Nd initialize ck_bag +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_init "struct ck_bag *bag, size_t n_cachelines, enum ck_bag_allocation_strategy as" +.Sh DESCRIPTION +The +.Fn ck_bag_init +function will initialize the object pointed to by the +.Fa bag +argument. If the +.Fa n_cachelines +argument is equivalent to CK_BAG_DEFAULT, then the block_size for the bag will +be CK_BAG_PAGESIZE (CK_MD_PAGESIZE). Otherwise, the block_size for the bag will +be n_cachelines * CK_MD_CACHELINE. The block_size, the number of bytes in a +single ck_bag_block, is set on a bag basis. +.Pp +.Fn ck_bag_init +will return false if the calculated block_size is less than the number of bytes +required by block overhead. Block overhead includes any allocator overhead +established from a previous call to the +.Fn ck_bag_allocator_set +function. +.Fn ck_bag_init +will also return false if you have compiled ck to pointer pack +and the number of entries within a block is greater than CK_BAG_MAX_N_ENTRIES. +On x86_64, CK_BAG_MAX_N_ENTRIES is equal to 4096. +.Sh RETURN VALUES +If +.Fn ck_bag_init +returns true then the object pointed to by the +.Fa bag +argument has been initialized. Otherwise, the object pointed to by the +.Fa bag +argument is not a valid ck_bag. +.Sh ERRORS +Behavior is undefined if +.Fa bag +does not point to a valid ck_bag object or if ck_bag_allocator_set has not been +called previously. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_iterator_init b/doc/ck_bag_iterator_init new file mode 100644 index 0000000..6b7387b --- /dev/null +++ b/doc/ck_bag_iterator_init @@ -0,0 +1,69 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_ITERATOR_INIT 3 +.Sh NAME +.Nm ck_bag_iterator_init +.Nd initialize a ck_bag_iterator +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft void +.Fn ck_bag_iterator_init "ck_bag_iterator_t *iterator, ck_bag_t *bag" +.Sh DESCRIPTION +The +.Fn ck_bag_iterator_init +function will initialize the object pointed to by the +.Fa iterator +argument. +.Pp +An iterator is used to iterate through the entries pointed to by the +.Fa bag +argument by using the +.Fn ck_bag_next +function. +.Sh ERRORS +Behavior is undefined if the ck_bag pointed to by the +.Fa bag +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_member_spmc b/doc/ck_bag_member_spmc new file mode 100644 index 0000000..1557d04 --- /dev/null +++ b/doc/ck_bag_member_spmc @@ -0,0 +1,71 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_MEMBER_SPMC 3 +.Sh NAME +.Nm ck_bag_member_spmc +.Nd determine whether a bag contains an entry +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_member_spmc "ck_bag_t *bag, void *entry" +.Sh DESCRIPTION +The +.Fn ck_bag_member_spmc +function will return true if the an item contained within the ck_bag +pointed to by the +.Fa bag +argument is equivalent to the +.Fa entry +argument. +.Sh RETURN VALUES +.Fn ck_bag_member_spmc +returns true if the +.Fa entry +argument was found in the bag, otherwise false. +.Sh ERRORS +Behavior is undefined if the ck_bag pointed to by the +.Fa bag +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_next b/doc/ck_bag_next new file mode 100644 index 0000000..64f321e --- /dev/null +++ b/doc/ck_bag_next @@ -0,0 +1,75 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_NEXT 3 +.Sh NAME +.Nm ck_bag_next +.Nd iterate to the next entry in the ck_bag +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_next "struct ck_bag_iterator *iterator, void **entry" +.Sh DESCRIPTION +The +.Fn ck_bag_next +function will assign the +.Fa entry +argument the next entry in the ck_bag. It is expected +.Fa iterator +has been initialized using the ck_bag_iterator_init(3) function. +.Sh RETURN VALUES +If +.Fn ck_bag_next +returns true then the object pointed to by +.Fa entry +points to a valid ck_bag entry. If +.Fn ck_bag_next +returns false then the value of +.Fa entry +is undefined. +.Sh ERRORS +Behavior is undefined if the ck_bag_iterator pointed to by the +.Fa iterator +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_put_spmc b/doc/ck_bag_put_spmc new file mode 100644 index 0000000..3a51eba --- /dev/null +++ b/doc/ck_bag_put_spmc @@ -0,0 +1,71 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_PUT_SPMC 3 +.Sh NAME +.Nm ck_bag_put_spmc +.Nd place an item into a bag +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_put_spmc "ck_bag_t *bag, void *entry" +.Sh DESCRIPTION +The +.Fn ck_bag_put_spmc +function will store the +.Fa entry +argument in the ck_bag pointed to by the +.Fa bag +argument. This function is safe in the presence of concurrent +.Fn ck_bag_next +operations. +.Sh RETURN VALUES +Upon completion +.Fn ck_bag_put_spmc +returns true on if the item has been placed within the bag, otherwise false. +.Sh ERRORS +Behavior is undefined if the ck_bag pointed to by the +.Fa bag +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_remove_spmc b/doc/ck_bag_remove_spmc new file mode 100644 index 0000000..6ff8398 --- /dev/null +++ b/doc/ck_bag_remove_spmc @@ -0,0 +1,69 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_REMOVE_SPMC 3 +.Sh NAME +.Nm ck_bag_remove_spmc +.Nd remove an entry from a bag +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_remove_spmc "ck_bag_t *bag, void *entry" +.Sh DESCRIPTION +The +.Fn ck_bag_remove_spmc +function will remove the first item equivalent to the value of the +.Fa entry +argument within the ck_bag pointed to by the +.Fa bag +argument. +.Sh RETURN VALUES +Upon completion +.Fn ck_bag_remove_spmc +returns true if an item in the ck_bag was removed, otherwise false on failure. +.Sh ERRORS +Behavior is undefined if +.Fa bag +has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/ diff --git a/doc/ck_bag_set_spmc b/doc/ck_bag_set_spmc new file mode 100644 index 0000000..5cdb513 --- /dev/null +++ b/doc/ck_bag_set_spmc @@ -0,0 +1,80 @@ +.\" +.\" Copyright 2012 Abel P. Mathew +.\" 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 +.\" 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 16th, 2012 +.Dt CK_BAG_SET_SPMC 3 +.Sh NAME +.Nm ck_bag_set_spmc +.Nd Replace the first occurence of a value in a bag. Insert value into the bag if value didn't previously exist. +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_bag.h +.Ft bool +.Fn ck_bag_set_spmc "ck_bag_t *bag, void *compare, void *update" +.Sh DESCRIPTION +The +.Fn ck_bag_set_spmc +function will find the first occurence of the +.Fa compare +argument in the ck_bag pointed to by the +.Fa bag +argument and replace this entry with the value passed in by the +.Fa update +argument. If the no entries in the +.Fa bag +are equal to the +.Fa compare +argument, then a new entry with the value of +.Fa update +will placed in the bag. +This function is safe in the presence of concurrent +.Fn ck_bag_next +operations. +.Sh RETURN VALUES +Upon completion +.Fn ck_bag_set_spmc +returns true on success, false on failure. +.Sh ERRORS +Behavior is undefined if the ck_bag pointed to by the +.Fa bag +argument has not been initialized. +.Sh SEE ALSO +.Xr ck_bag_allocator_set(3), +.Xr ck_bag_block_next(3), +.Xr ck_bag_destroy(3), +.Xr ck_bag_iterator_init(3), +.Xr ck_bag_next(3), +.Xr ck_bag_remove_spmc(3), +.Xr ck_bag_block_count(3), +.Xr ck_bag_count(3), +.Xr ck_bag_init(3), +.Xr ck_bag_member_spmc(3), +.Xr ck_bag_put_spmc(3), +.Xr ck_bag_set_spmc(3) +.Pp +Additional information available at http://concurrencykit.org/