http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_atomic_store ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_atomic_store b/lib/ck/doc/ck_pr_fence_atomic_store new file mode 100644 index 0000000..a14867c --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_atomic_store @@ -0,0 +1,109 @@ +.\" +.\" 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 16, 2013 +.Dt CK_PR_FENCE_ATOMIC_STORE 3 +.Sh NAME +.Nm ck_pr_fence_atomic_store +.Nd enforce ordering of atomic read-modify-write operations to store operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_atomic_store void +.Ft void +.Fn ck_pr_fence_strict_atomic_store void +.Sh DESCRIPTION +The +.Fn ck_pr_fence_atomic_store +function enfores the ordering of any +atomic read-modify-write operations relative to +any load operations following the function invocation. This function +always serve as an implicit compiler barrier. On +architectures implementing CK_MD_TSO, this operation +only serves as a compiler barrier and no fences +are emitted. To force the unconditional emission of +a fence, use +.Fn ck_pr_fence_strict_atomic_store . +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static int a = 0; +static int b = 0; + +void +function(void) +{ + int c; + + ck_pr_fas_int(&a, 1); + + /* + * Guarantee that the update to a is completed + * with respect to the store into the value pointed + * to by b. + */ + ck_pr_fence_atomic_store(); + c = ck_pr_store_int(&b, 2); + + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_load ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_load b/lib/ck/doc/ck_pr_fence_load new file mode 100644 index 0000000..da8e6d4 --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_load @@ -0,0 +1,113 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_fence_load 3 +.Sh NAME +.Nm ck_pr_fence_load +.Nd enforce partial ordering of load operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_load void +.Ft void +.Fn ck_pr_fence_strict_load void +.Sh DESCRIPTION +This function enforces the ordering of any memory load +and +.Fn ck_pr_load 3 +operations relative to the invocation of the function. Any +store operations that were committed on remote processors +and received by the calling processor before the invocation of +.Fn ck_pr_fence_load +is also be made visible only after a call to +.Fn ck_pr_fence_load . +This function always serves as an implicit compiler barrier. +On architectures with CK_MD_TSO or CK_MD_PSO specified (total store ordering +and partial store ordering respectively), this operation only serves +as a compiler barrier and no fence instructions will be emitted. To +force the unconditional emission of a load fence, use +.Fn ck_pr_fence_strict_load . +Architectures implementing CK_MD_RMO always emit a load fence. +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static unsigned int a; +static unsigned int b; + +void +function(void) +{ + unsigned int snapshot_a, snapshot_b; + + snapshot_a = ck_pr_load_uint(&a); + + /* + * Guarantee that the load from "a" completes + * before the load from "b". + */ + ck_pr_fence_load(); + snapshot_b = ck_pr_load_uint(&b); + + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_load_atomic ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_load_atomic b/lib/ck/doc/ck_pr_fence_load_atomic new file mode 100644 index 0000000..774a263 --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_load_atomic @@ -0,0 +1,113 @@ +.\" +.\" 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 18, 2013 +.Dt CK_PR_FENCE_LOAD_ATOMIC 3 +.Sh NAME +.Nm ck_pr_fence_load_atomic +.Nd enforce ordering of load operations to atomic read-modify-write operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_load_atomic void +.Ft void +.Fn ck_pr_fence_strict_load_atomic void +.Sh DESCRIPTION +This function enforces the ordering of any memory load +and +.Fn ck_pr_load 3 +operations with respect to store operations relative to +the invocation of the function. Any store operations that +were committed on remote processors +and received by the calling processor before the invocation of +.Fn ck_pr_fence_load_atomic +is also be made visible only after a call to +the ck_pr_fence_load family of functions. +This function always serves as an implicit compiler barrier. +On architectures with CK_MD_TSO or CK_MD_PSO specified (total store ordering +and partial store ordering respectively), this operation only serves +as a compiler barrier and no fence instructions will be emitted. To +force the unconditional emission of a load fence, use +.Fn ck_pr_fence_strict_load_atomic . +Architectures implementing CK_MD_RMO always emit a fence. +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static unsigned int a; +static unsigned int b; + +void +function(void) +{ + unsigned int snapshot_a, snapshot_b; + + snapshot_a = ck_pr_load_uint(&a); + + /* + * Guarantee that the load from "a" completes + * before the update to "b". + */ + ck_pr_fence_load_atomic(); + ck_pr_fas_uint(&b, 1); + + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_load_depends ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_load_depends b/lib/ck/doc/ck_pr_fence_load_depends new file mode 100644 index 0000000..38718ec --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_load_depends @@ -0,0 +1,75 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_fence_load_depends 3 +.Sh NAME +.Nm ck_pr_fence_load_depends +.Nd data dependency barrier +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_load_depends void +.Sh DESCRIPTION +The +.Fn ck_pr_fence_load_depends 3 +emits necessary fences for pure data-dependent loads. It currently only serves as a compiler +barrier for Concurrency Kit's supported platforms. Unless you're on architecture +which re-orders data-dependent loads (such as the defunct Alpha), this function is unnecessary. +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_load_store ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_load_store b/lib/ck/doc/ck_pr_fence_load_store new file mode 100644 index 0000000..378903e --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_load_store @@ -0,0 +1,113 @@ +.\" +.\" 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 18, 2013 +.Dt CK_PR_FENCE_LOAD_STORE 3 +.Sh NAME +.Nm ck_pr_fence_load_store +.Nd enforce ordering of load operations to store operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_load_store void +.Ft void +.Fn ck_pr_fence_strict_load_store void +.Sh DESCRIPTION +This function enforces the ordering of any memory load +and +.Fn ck_pr_load 3 +operations with respect to store operations relative to +the invocation of the function. Any store operations that +were committed on remote processors +and received by the calling processor before the invocation of +.Fn ck_pr_fence_load_store +is also be made visible only after a call to +the ck_pr_fence_load family of functions. +This function always serves as an implicit compiler barrier. +On architectures with CK_MD_TSO or CK_MD_PSO specified (total store ordering +and partial store ordering respectively), this operation only serves +as a compiler barrier and no fence instructions will be emitted. To +force the unconditional emission of a load fence, use +.Fn ck_pr_fence_strict_load_store . +Architectures implementing CK_MD_RMO always emit a fence. +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static unsigned int a; +static unsigned int b; + +void +function(void) +{ + unsigned int snapshot_a; + + snapshot_a = ck_pr_load_uint(&a); + + /* + * Guarantee that the load from "a" completes + * before the store to "b". + */ + ck_pr_fence_load_store(); + ck_pr_store_uint(&b, 1); + + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_memory ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_memory b/lib/ck/doc/ck_pr_fence_memory new file mode 100644 index 0000000..f223527 --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_memory @@ -0,0 +1,113 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_fence_memory 3 +.Sh NAME +.Nm ck_pr_fence_memory +.Nd enforce partial ordering of all memory operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_memory +.Ft void +.Fn ck_pr_fence_strict_memory +.Sh DESCRIPTION +The +.Fn ck_pr_fence_memory 3 +function enforces the ordering of any memory operations +with respect to the invocation of the function. This function +always serves as an implicit compiler barrier. +Achitectures implementing CK_MD_TSO do not emit +a barrier, but compiler barrier semantics remain. +Architectures implementing CK_MD_PSO and CK_MD_RMO always emit +an instructions which provides the specified ordering +guarantees. To force the unconditional emission of a memory +fence, use +.Fn ck_pr_fence_strict_memory . +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static int a = 0; +static int b; +static int c; +static int d; + +void +function(void) +{ + int snapshot_a; + + ck_pr_store_int(&b, 1); + snapshot_a = ck_pr_load_int(&a); + + /* + * Make sure previous memory operations are + * ordered with respect to memory operations + * following the ck_pr_fence_memory. + */ + ck_pr_fence_memory(); + + ck_pr_store_int(&d, 3); + ck_pr_store_int(&c, 2); + + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_release ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_release b/lib/ck/doc/ck_pr_fence_release new file mode 100644 index 0000000..6794bbf --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_release @@ -0,0 +1,71 @@ +.\" +.\" Copyright 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 January 2, 2014 +.Dt CK_PR_FENCE_RELEASE 3 +.Sh NAME +.Nm ck_pr_fence_release +.Nd enforce release semantics +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_release void +.Sh DESCRIPTION +This function enforces the partial ordering of any loads prior +to invocation with respect to any following stores and any stores +prior to invocation with respect to any following stores. +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_acquire 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_store ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_store b/lib/ck/doc/ck_pr_fence_store new file mode 100644 index 0000000..5bb8f00 --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_store @@ -0,0 +1,112 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_fence_store 3 +.Sh NAME +.Nm ck_pr_fence_store +.Nd enforce partial ordering of store operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_store void +.Ft void +.Fn ck_pr_fence_strict_store void +.Sh DESCRIPTION +The +.Fn ck_pr_fence_store +function enfores the ordering of any memory store, +.Fn ck_pr_store +and atomic read-modify-write operations relative to +the invocation of the function. This function +always serve as an implicit compiler barrier. On +architectures implementing CK_MD_TSO, this operation +only serves as a compiler barrier and no fences +are emitted. On architectures implementing +CK_MD_PSO and CK_MD_RMO, a store fence is +emitted. To force the unconditional emission of +a store fence, use +.Fn ck_pr_fence_strict_store . +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static int a = 0; +static int b = 0; +static int c = 0; + +void +function(void) +{ + + ck_pr_store_int(&a, 1); + + /* + * Guarantee that the store to a is completed + * with respect to the stores of b and c. + */ + ck_pr_fence_store(); + ck_pr_store_int(&b, 2); + ck_pr_store_int(&c, 2); + + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_store_atomic ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_store_atomic b/lib/ck/doc/ck_pr_fence_store_atomic new file mode 100644 index 0000000..a559f22 --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_store_atomic @@ -0,0 +1,108 @@ +.\" +.\" 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 18, 2013 +.Dt CK_PR_FENCE_STORE_ATOMIC 3 +.Sh NAME +.Nm ck_pr_fence_store_atomic +.Nd enforce ordering of store operations to load operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_store_atomic void +.Ft void +.Fn ck_pr_fence_strict_store_atomic void +.Sh DESCRIPTION +The +.Fn ck_pr_fence_store_atomic +function enfores the ordering of any memory store, +.Fn ck_pr_store +and atomic read-modify-write operations to atomic read-modify-write +operations relative to the invocation of the function. This function +always serve as an implicit compiler barrier. +This functions will emit a fence for PSO and RMO +targets. In order to force the emission of a fence use the +.Fn ck_pr_fence_strict_store_atomic +function. +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static int a = 0; +static int b = 0; + +void +function(void) +{ + + ck_pr_store_int(&a, 1); + + /* + * Guarantee that the store to a is completed + * with respect to the update of b. + */ + ck_pr_fence_store_atomic(); + ck_pr_add_int(&b, 2); + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_store_load 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_fence_store_load ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_fence_store_load b/lib/ck/doc/ck_pr_fence_store_load new file mode 100644 index 0000000..40d1875 --- /dev/null +++ b/lib/ck/doc/ck_pr_fence_store_load @@ -0,0 +1,107 @@ +.\" +.\" 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 18, 2013 +.Dt CK_PR_FENCE_STORE_LOAD 3 +.Sh NAME +.Nm ck_pr_fence_store_load +.Nd enforce ordering of store operations to load operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_fence_store_load void +.Ft void +.Fn ck_pr_fence_strict_store_load void +.Sh DESCRIPTION +The +.Fn ck_pr_fence_store_load +function enfores the ordering of any memory store, +.Fn ck_pr_store +and atomic read-modify-write operations to load +operations relative to the invocation of the function. This function +always serve as an implicit compiler barrier. +A fence will currently always be emitted for this +operation, including for TSO memory model targets. +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static int a = 0; +static int b = 0; + +void +function(void) +{ + unsigned int snapshot_b; + + ck_pr_store_int(&a, 1); + + /* + * Guarantee that the store to a is completed + * with respect to load from b. + */ + ck_pr_fence_store_load(); + snapshot_b = ck_pr_load_int(&b, 2); + return; +} +.Ed +.Sh RETURN VALUES +This function has no return value. +.Sh SEE ALSO +.Xr ck_pr_stall 3 , +.Xr ck_pr_fence_atomic 3 , +.Xr ck_pr_fence_atomic_store 3 , +.Xr ck_pr_fence_atomic_load 3 , +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_atomic 3 , +.Xr ck_pr_fence_load_store 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_store_atomic 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_inc ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_inc b/lib/ck/doc/ck_pr_inc new file mode 100644 index 0000000..0b8f449 --- /dev/null +++ b/lib/ck/doc/ck_pr_inc @@ -0,0 +1,124 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_inc 3 +.Sh NAME +.Nm ck_pr_inc_ptr , +.Nm ck_pr_inc_ptr_zero , +.Nm ck_pr_inc_double , +.Nm ck_pr_inc_double_zero , +.Nm ck_pr_inc_char , +.Nm ck_pr_inc_char_zero , +.Nm ck_pr_inc_uint , +.Nm ck_pr_inc_uint_zero , +.Nm ck_pr_inc_int , +.Nm ck_pr_inc_int_zero , +.Nm ck_pr_inc_64 , +.Nm ck_pr_inc_64_zero , +.Nm ck_pr_inc_32 , +.Nm ck_pr_inc_32_zero , +.Nm ck_pr_inc_16 , +.Nm ck_pr_inc_16_zero , +.Nm ck_pr_inc_8 , +.Nm ck_pr_inc_8_zero +.Nd atomic increment operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_inc_ptr "void *target" +.Ft void +.Fn ck_pr_inc_ptr_zero "void *target" "bool *z" +.Ft void +.Fn ck_pr_inc_double "double *target" +.Ft void +.Fn ck_pr_inc_double_zero "double *target" "bool *z" +.Ft void +.Fn ck_pr_inc_char "char *target" +.Ft void +.Fn ck_pr_inc_char_zero "char *target" "bool *z" +.Ft void +.Fn ck_pr_inc_uint "unsigned int *target" +.Ft void +.Fn ck_pr_inc_uint_zero "unsigned int *target" "bool *z" +.Ft void +.Fn ck_pr_inc_int "int *target" +.Ft void +.Fn ck_pr_inc_int_zero "int *target" "bool *z" +.Ft void +.Fn ck_pr_inc_64 "uint64_t *target" +.Ft void +.Fn ck_pr_inc_64_zero "uint64_t *target" "bool *z" +.Ft void +.Fn ck_pr_inc_32 "uint32_t *target" +.Ft void +.Fn ck_pr_inc_32_zero "uint32_t *target" "bool *z" +.Ft void +.Fn ck_pr_inc_16 "uint16_t *target" +.Ft void +.Fn ck_pr_inc_16_zero "uint16_t *target" "bool *z" +.Ft void +.Fn ck_pr_inc_8 "uint8_t *target" +.Ft void +.Fn ck_pr_inc_8_zero "uint8_t *target" "bool *z" +.Sh DESCRIPTION +The +.Fn ck_pr_inc 3 +family of functions atomically increment the value pointed to +by +.Fa target . +.Sh RETURN VALUES +The ck_pr_inc_zero family of functions set the value pointed to by +.Fa z +to true if the result of the increment operation was 0. The functions set +the value pointed to by +.Fa z +false otherwise. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_load ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_load b/lib/ck/doc/ck_pr_load new file mode 100644 index 0000000..f0ab96d --- /dev/null +++ b/lib/ck/doc/ck_pr_load @@ -0,0 +1,96 @@ +.\" +.\" 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 April 15, 2013 +.Dt ck_pr_load 3 +.Sh NAME +.Nm ck_pr_load_ptr , +.Nm ck_pr_load_double , +.Nm ck_pr_load_uint , +.Nm ck_pr_load_int , +.Nm ck_pr_load_char , +.Nm ck_pr_load_64 , +.Nm ck_pr_load_32 , +.Nm ck_pr_load_16 , +.Nm ck_pr_load_8 +.Nd atomic volatile load operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void * +.Fn ck_pr_load_ptr "const void *target" +.Ft double +.Fn ck_pr_load_double "const double *target" +.Ft unsigned int +.Fn ck_pr_load_uint "const unsigned int *target" +.Ft int +.Fn ck_pr_load_int "const int *target" +.Ft char +.Fn ck_pr_load_char "const char *target" +.Ft uint64_t +.Fn ck_pr_load_64 "const uint64_t *target" +.Ft uint32_t +.Fn ck_pr_load_32 "const uint32_t *target" +.Ft uint16_t +.Fn ck_pr_load_16 "const uint16_t *target" +.Ft uint8_t +.Fn ck_pr_load_8 "const uint8_t *target" +.Sh DESCRIPTION +The +.Fn ck_pr_load 3 +family of functions atomically loads the value +pointed to by +.Fa target +and returns it. This family of functions always +serves as an implicit compiler barrier and is not +susceptible to re-ordering by the compiler. +.Sh RETURN VALUES +This family of functions returns the value contained +in the location pointed to by the first argument. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_neg ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_neg b/lib/ck/doc/ck_pr_neg new file mode 100644 index 0000000..6654856 --- /dev/null +++ b/lib/ck/doc/ck_pr_neg @@ -0,0 +1,122 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_neg 3 +.Sh NAME +.Nm ck_pr_neg_ptr , +.Nm ck_pr_neg_ptr_zero , +.Nm ck_pr_neg_double , +.Nm ck_pr_neg_double_zero , +.Nm ck_pr_neg_char , +.Nm ck_pr_neg_char_zero , +.Nm ck_pr_neg_uint , +.Nm ck_pr_neg_uint_zero , +.Nm ck_pr_neg_int , +.Nm ck_pr_neg_int_zero , +.Nm ck_pr_neg_64 , +.Nm ck_pr_neg_64_zero , +.Nm ck_pr_neg_32 , +.Nm ck_pr_neg_32_zero , +.Nm ck_pr_neg_16 , +.Nm ck_pr_neg_16_zero , +.Nm ck_pr_neg_8 , +.Nm ck_pr_neg_8_zero +.Nd atomic negation operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_neg_ptr "void *target" +.Ft void +.Fn ck_pr_neg_ptr_zero "void *target" "bool *z" +.Ft void +.Fn ck_pr_neg_double "double *target" +.Ft void +.Fn ck_pr_neg_double_zero "double *target" "bool *z" +.Ft void +.Fn ck_pr_neg_char "char *target" +.Ft void +.Fn ck_pr_neg_char_zero "char *target" "bool *z" +.Ft void +.Fn ck_pr_neg_uint "unsigned int *target" +.Ft void +.Fn ck_pr_neg_uint_zero "unsigned int *target" "bool *z" +.Ft void +.Fn ck_pr_neg_int "int *target" +.Ft void +.Fn ck_pr_neg_int_zero "int *target" "bool *z" +.Ft void +.Fn ck_pr_neg_64 "uint64_t *target" +.Ft void +.Fn ck_pr_neg_64_zero "uint64_t *target" "bool *z" +.Ft void +.Fn ck_pr_neg_32 "uint32_t *target" +.Ft void +.Fn ck_pr_neg_32_zero "uint32_t *target" "bool *z" +.Ft void +.Fn ck_pr_neg_16 "uint16_t *target" +.Ft void +.Fn ck_pr_neg_16_zero "uint16_t *target" "bool *z" +.Ft void +.Fn ck_pr_neg_8 "uint8_t *target" +.Ft void +.Fn ck_pr_neg_8_zero "uint8_t *target" "bool *z" +.Sh DESCRIPTION +The +.Fn ck_pr_neg 3 +family of functions atomically negate the value pointed to +by +.Fa target . +.Sh RETURN VALUES +The ck_pr_neg_zero functions set the value pointed to by +.Fa z +if the result of the negation operation was 0. They set the +pointed to value to false otherwise. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_not ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_not b/lib/ck/doc/ck_pr_not new file mode 100644 index 0000000..d6eb51c --- /dev/null +++ b/lib/ck/doc/ck_pr_not @@ -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 April 7, 2013 +.Dt ck_pr_not 3 +.Sh NAME +.Nm ck_pr_not_ptr , +.Nm ck_pr_not_double , +.Nm ck_pr_not_char , +.Nm ck_pr_not_uint , +.Nm ck_pr_not_int , +.Nm ck_pr_not_64 , +.Nm ck_pr_not_32 , +.Nm ck_pr_not_16 , +.Nm ck_pr_not_8 +.Nd atomic complement operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_not_ptr "void *target" +.Ft void +.Fn ck_pr_not_double "double *target" +.Ft void +.Fn ck_pr_not_char "char *target" +.Ft void +.Fn ck_pr_not_uint "unsigned int *target" +.Ft void +.Fn ck_pr_not_int "int *target" +.Ft void +.Fn ck_pr_not_64 "uint64_t *target" +.Ft void +.Fn ck_pr_not_32 "uint32_t *target" +.Ft void +.Fn ck_pr_not_16 "uint16_t *target" +.Ft void +.Fn ck_pr_not_8 "uint8_t *target" +.Sh DESCRIPTION +The +.Fn ck_pr_not 3 +family of functions atomically complement the value pointed to +by +.Fa target . +.Sh RETURN VALUES +These functions have no return value. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_or ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_or b/lib/ck/doc/ck_pr_or new file mode 100644 index 0000000..9ceddc5 --- /dev/null +++ b/lib/ck/doc/ck_pr_or @@ -0,0 +1,93 @@ +.\" +.\" 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 April 11, 2013 +.Dt ck_pr_or 3 +.Sh NAME +.Nm ck_pr_or_ptr , +.Nm ck_pr_or_char , +.Nm ck_pr_or_uint , +.Nm ck_pr_or_int , +.Nm ck_pr_or_64 , +.Nm ck_pr_or_32 , +.Nm ck_pr_or_16 , +.Nm ck_pr_or_8 +.Nd atomic bitwise-or operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_or_ptr "void *target" "uintptr_t delta" +.Ft void +.Fn ck_pr_or_char "char *target" "char delta" +.Ft void +.Fn ck_pr_or_uint "unsigned int *target" "unsigned int delta" +.Ft void +.Fn ck_pr_or_int "int *target" "int delta" +.Ft void +.Fn ck_pr_or_64 "uint64_t *target" "uint64_t delta" +.Ft void +.Fn ck_pr_or_32 "uint32_t *target" "uint32_t delta" +.Ft void +.Fn ck_pr_or_16 "uint16_t *target" "uint16_t delta" +.Ft void +.Fn ck_pr_or_8 "uint8_t *target" "uint8_t delta" +.Sh DESCRIPTION +The +.Fn ck_pr_or 3 +family of functions atomically compute and store the +result of a bitwise-or of the value pointed to by +.Fa target +and +.Fa delta +into the value pointed to by +.Fa target . +.Sh RETURN VALUES +This family of functions does not have a return value. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_rtm ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_rtm b/lib/ck/doc/ck_pr_rtm new file mode 100644 index 0000000..a15aa91 --- /dev/null +++ b/lib/ck/doc/ck_pr_rtm @@ -0,0 +1,112 @@ +.\" +.\" 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_pr_rtm 3 +.Sh NAME +.Nm ck_pr_rtm_begin , +.Nm ck_pr_rtm_end , +.Nm ck_pr_rtm_abort , +.Nm ck_pr_rtm_test +.Nd restricted transactional memory +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft unsigned int +.Fn ck_pr_rtm_begin "void" +.Ft void +.Fn ck_pr_rtm_end "void" +.Ft void +.Fn ck_pr_rtm_abort "const unsigned int status" +.Ft bool +.Fn ck_pr_rtm_test "void" +.Sh DESCRIPTION +These family of functions implement support for restricted +transactional memory, if available on the underlying platform. +Currently, support is only provided for Intel Haswell and +newer x86 microarchitectures that have the TSX-NI feature. +.Pp +The +.Fn ck_pr_rtm_begin +function returns CK_PR_RTM_STARTED if a transaction was successfully +started. In case of an abort, either internal (through a ck_pr_rtm_abort) +or external, program flow will return to the point which the function +was called except the return value will consist of a bitmap with one or +more of the following bits set: +.Bl -tag -width indent +.It CK_PR_RTM_EXPLICIT +Set if the transactionally was explicitly aborted through +.Fn ck_pr_rtm_abort . +.It CK_PR_RTM_RETRY +Set if the transaction failed but can still succeed if +retried. +.It CK_PR_RTM_CONFLICT +The transaction failed due to a conflict in one of the memory +addresses that are part of the working set of the transaction. +.It CK_PR_RTM_CAPACITY +Set if the architecture-defined transaction size limit was exceeded. +.It CK_PR_RTM_DEBUG +Set if a hardware breakpoint was triggered. +.It CK_PR_RTM_NESTED +Set if a nested transaction failed. +.El +.Pp +The user is also able to specify a one byte abort status +by calling +.Fn ck_pr_rtm_abort . +This status byte can be extracted by calling the +.Fn CK_PR_RTM_CODE +function with the return value of +.Fn ck_pr_rtm_begin +as an argument. The return value of +.Fn CK_PR_RTM_CODE +will be the value of this status byte. +For additional information, please see the Intel instruction +set manuals. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_stall ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_stall b/lib/ck/doc/ck_pr_stall new file mode 100644 index 0000000..762a739 --- /dev/null +++ b/lib/ck/doc/ck_pr_stall @@ -0,0 +1,86 @@ +.\" +.\" 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 April 7, 2013 +.Dt ck_pr_stall 3 +.Sh NAME +.Nm ck_pr_stall +.Nd busy-wait primitive +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_stall void +.Sh DESCRIPTION +The +.Fn ck_pr_stall 3 +function should be used inside retry paths of busy-wait loops. +It not only serves as a compiler barrier, but on some architectures +it emits cycle-saving instructions. +.Sh EXAMPLE +.Bd -literal -offset indent + +#include <ck_pr.h> + +static int ready = 0; + +void +function(void) +{ + + /* Busy-wait until ready is non-zero. */ + while (ck_pr_load_int(&ready) == 0) + ck_pr_stall(); + + return; +} +.Ed +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_barrier 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_store ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_store b/lib/ck/doc/ck_pr_store new file mode 100644 index 0000000..5cc7053 --- /dev/null +++ b/lib/ck/doc/ck_pr_store @@ -0,0 +1,96 @@ +.\" +.\" 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 April 15, 2013 +.Dt ck_pr_store 3 +.Sh NAME +.Nm ck_pr_store_ptr , +.Nm ck_pr_store_double , +.Nm ck_pr_store_uint , +.Nm ck_pr_store_int , +.Nm ck_pr_store_char , +.Nm ck_pr_store_64 , +.Nm ck_pr_store_32 , +.Nm ck_pr_store_16 , +.Nm ck_pr_store_8 +.Nd atomic volatile store operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_store_ptr "void *target" "void *value" +.Ft void +.Fn ck_pr_store_double "double *target" "double value" +.Ft void +.Fn ck_pr_store_uint "unsigned int *target" "unsigned int value" +.Ft void +.Fn ck_pr_store_int "int *target" "int value" +.Ft void +.Fn ck_pr_store_char "char *target" "char value" +.Ft void +.Fn ck_pr_store_64 "uint64_t *target" "uint64_t value" +.Ft void +.Fn ck_pr_store_32 "uint32_t *target" "uint32_t value" +.Ft void +.Fn ck_pr_store_16 "uint16_t *target" "uint16_t value" +.Ft void +.Fn ck_pr_store_8 "uint8_t *target" "uint8_t value" +.Sh DESCRIPTION +The +.Fn ck_pr_store 3 +family of functions atomically stores the value specified +by +.Fa value +into the location pointed to by +.Fa target . +This family of functions always serves as an implicit compiler +barrier and is not susceptible to compiler re-ordering. +.Sh RETURN VALUES +This family of functions has no return value. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_sub ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_sub b/lib/ck/doc/ck_pr_sub new file mode 100644 index 0000000..697ea1b --- /dev/null +++ b/lib/ck/doc/ck_pr_sub @@ -0,0 +1,93 @@ +.\" +.\" 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 April 11, 2013 +.Dt ck_pr_sub 3 +.Sh NAME +.Nm ck_pr_sub_ptr , +.Nm ck_pr_sub_double , +.Nm ck_pr_sub_char , +.Nm ck_pr_sub_uint , +.Nm ck_pr_sub_int , +.Nm ck_pr_sub_64 , +.Nm ck_pr_sub_32 , +.Nm ck_pr_sub_16 , +.Nm ck_pr_sub_8 +.Nd atomic subtraction operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_sub_ptr "void *target" "uintptr_t delta" +.Ft void +.Fn ck_pr_sub_double "double *target" "double delta" +.Ft void +.Fn ck_pr_sub_char "char *target" "char delta" +.Ft void +.Fn ck_pr_sub_uint "unsigned int *target" "unsigned int delta" +.Ft void +.Fn ck_pr_sub_int "int *target" "int delta" +.Ft void +.Fn ck_pr_sub_64 "uint64_t *target" "uint64_t delta" +.Ft void +.Fn ck_pr_sub_32 "uint32_t *target" "uint32_t delta" +.Ft void +.Fn ck_pr_sub_16 "uint16_t *target" "uint16_t delta" +.Ft void +.Fn ck_pr_sub_8 "uint8_t *target" "uint8_t delta" +.Sh DESCRIPTION +The +.Fn ck_pr_sub 3 +family of functions atomically subtract the value specified by +.Fa delta +from the value pointed to by +.Fa target . +.Sh RETURN VALUES +This family of functions does not have a return value. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_xor 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_pr_xor ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_pr_xor b/lib/ck/doc/ck_pr_xor new file mode 100644 index 0000000..cda38cb --- /dev/null +++ b/lib/ck/doc/ck_pr_xor @@ -0,0 +1,93 @@ +.\" +.\" 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 April 11, 2013 +.Dt ck_pr_xor 3 +.Sh NAME +.Nm ck_pr_xor_ptr , +.Nm ck_pr_xor_char , +.Nm ck_pr_xor_uint , +.Nm ck_pr_xor_int , +.Nm ck_pr_xor_64 , +.Nm ck_pr_xor_32 , +.Nm ck_pr_xor_16 , +.Nm ck_pr_xor_8 +.Nd atomic bitwise-xor operations +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_pr.h +.Ft void +.Fn ck_pr_xor_ptr "void *target" "uintptr_t delta" +.Ft void +.Fn ck_pr_xor_char "char *target" "char delta" +.Ft void +.Fn ck_pr_xor_uint "unsigned int *target" "unsigned int delta" +.Ft void +.Fn ck_pr_xor_int "int *target" "int delta" +.Ft void +.Fn ck_pr_xor_64 "uint64_t *target" "uint64_t delta" +.Ft void +.Fn ck_pr_xor_32 "uint32_t *target" "uint32_t delta" +.Ft void +.Fn ck_pr_xor_16 "uint16_t *target" "uint16_t delta" +.Ft void +.Fn ck_pr_xor_8 "uint8_t *target" "uint8_t delta" +.Sh DESCRIPTION +The +.Fn ck_pr_xor 3 +family of functions atomically compute and store the +result of a bitwise-xor of the value pointed to by +.Fa target +and +.Fa delta +into the value pointed to by +.Fa target . +.Sh RETURN VALUES +This family of functions does not have a return value. +.Sh SEE ALSO +.Xr ck_pr_fence_load 3 , +.Xr ck_pr_fence_load_depends 3 , +.Xr ck_pr_fence_store 3 , +.Xr ck_pr_fence_memory 3 , +.Xr ck_pr_load 3 , +.Xr ck_pr_store 3 , +.Xr ck_pr_fas 3 , +.Xr ck_pr_faa 3 , +.Xr ck_pr_inc 3 , +.Xr ck_pr_dec 3 , +.Xr ck_pr_neg 3 , +.Xr ck_pr_not 3 , +.Xr ck_pr_add 3 , +.Xr ck_pr_sub 3 , +.Xr ck_pr_or 3 , +.Xr ck_pr_and 3 , +.Xr ck_pr_cas 3 , +.Xr ck_pr_btc 3 , +.Xr ck_pr_bts 3 , +.Xr ck_pr_btr 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_queue ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_queue b/lib/ck/doc/ck_queue new file mode 100644 index 0000000..a27ec15 --- /dev/null +++ b/lib/ck/doc/ck_queue @@ -0,0 +1,147 @@ +.\" +.\" 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 28, 2013. +.Dt ck_queue 3 +.Sh NAME +.Nm CK_LIST_EMPTY , +.Nm CK_LIST_ENTRY , +.Nm CK_LIST_FIRST , +.Nm CK_LIST_FOREACH , +.Nm CK_LIST_FOREACH_SAFE , +.Nm CK_LIST_HEAD , +.Nm CK_LIST_HEAD_INITIALIZER , +.Nm CK_LIST_INIT , +.Nm CK_LIST_INSERT_AFTER , +.Nm CK_LIST_INSERT_BEFORE , +.Nm CK_LIST_INSERT_HEAD , +.Nm CK_LIST_MOVE , +.Nm CK_LIST_NEXT , +.Nm CK_LIST_REMOVE , +.Nm CK_LIST_SWAP , +.Nm CK_SLIST_EMPTY , +.Nm CK_SLIST_ENTRY , +.Nm CK_SLIST_FIRST , +.Nm CK_SLIST_FOREACH , +.Nm CK_SLIST_FOREACH_PREVPTR , +.Nm CK_SLIST_FOREACH_SAFE , +.Nm CK_SLIST_HEAD , +.Nm CK_SLIST_HEAD_INITIALIZER , +.Nm CK_SLIST_INIT , +.Nm CK_SLIST_INSERT_AFTER , +.Nm CK_SLIST_INSERT_HEAD , +.Nm CK_SLIST_MOVE , +.Nm CK_SLIST_NEXT , +.Nm CK_SLIST_REMOVE , +.Nm CK_SLIST_REMOVE_AFTER , +.Nm CK_SLIST_REMOVE_HEAD , +.Nm CK_SLIST_SWAP , +.Nm CK_STAILQ_CONCAT , +.Nm CK_STAILQ_EMPTY , +.Nm CK_STAILQ_ENTRY , +.Nm CK_STAILQ_FIRST , +.Nm CK_STAILQ_FOREACH , +.Nm CK_STAILQ_FOREACH_SAFE , +.Nm CK_STAILQ_HEAD , +.Nm CK_STAILQ_HEAD_INITIALIZER , +.Nm CK_STAILQ_INIT , +.Nm CK_STAILQ_INSERT_AFTER , +.Nm CK_STAILQ_INSERT_HEAD , +.Nm CK_STAILQ_INSERT_TAIL , +.Nm CK_STAILQ_MOVE , +.Nm CK_STAILQ_NEXT , +.Nm CK_STAILQ_REMOVE , +.Nm CK_STAILQ_REMOVE_AFTER , +.Nm CK_STAILQ_REMOVE_HEAD , +.Nm CK_STAILQ_SWAP +.Nd multi-reader single-writer singly-linked lists, singly-linked tail queues and lists +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_queue.h +.Fn CK_LIST_EMPTY +.Fn CK_LIST_ENTRY +.Fn CK_LIST_FIRST +.Fn CK_LIST_FOREACH +.Fn CK_LIST_FOREACH_SAFE +.Fn CK_LIST_HEAD +.Fn CK_LIST_HEAD_INITIALIZER +.Fn CK_LIST_INIT +.Fn CK_LIST_INSERT_AFTER +.Fn CK_LIST_INSERT_BEFORE +.Fn CK_LIST_INSERT_HEAD +.Fn CK_LIST_MOVE +.Fn CK_LIST_NEXT +.Fn CK_LIST_REMOVE +.Fn CK_LIST_SWAP +.Fn CK_SLIST_EMPTY +.Fn CK_SLIST_ENTRY +.Fn CK_SLIST_FIRST +.Fn CK_SLIST_FOREACH +.Fn CK_SLIST_FOREACH_PREVPTR +.Fn CK_SLIST_FOREACH_SAFE +.Fn CK_SLIST_HEAD +.Fn CK_SLIST_HEAD_INITIALIZER +.Fn CK_SLIST_INIT +.Fn CK_SLIST_INSERT_AFTER +.Fn CK_SLIST_INSERT_HEAD +.Fn CK_SLIST_MOVE +.Fn CK_SLIST_NEXT +.Fn CK_SLIST_REMOVE +.Fn CK_SLIST_REMOVE_AFTER +.Fn CK_SLIST_REMOVE_HEAD +.Fn CK_SLIST_SWAP +.Fn CK_STAILQ_CONCAT +.Fn CK_STAILQ_EMPTY +.Fn CK_STAILQ_ENTRY +.Fn CK_STAILQ_FIRST +.Fn CK_STAILQ_FOREACH +.Fn CK_STAILQ_FOREACH_SAFE +.Fn CK_STAILQ_HEAD +.Fn CK_STAILQ_HEAD_INITIALIZER +.Fn CK_STAILQ_INIT +.Fn CK_STAILQ_INSERT_AFTER +.Fn CK_STAILQ_INSERT_HEAD +.Fn CK_STAILQ_INSERT_TAIL +.Fn CK_STAILQ_MOVE +.Fn CK_STAILQ_NEXT +.Fn CK_STAILQ_REMOVE +.Fn CK_STAILQ_REMOVE_AFTER +.Fn CK_STAILQ_REMOVE_HEAD +.Fn CK_STAILQ_SWAP +.Sh DESCRIPTION +See your system's manual page for +.Xr queue +for additional information. ck_queue is a queue.h-compatible +implementation of many-reader-single-writer queues. It allows +for safe concurrent iteration, peeking and read-side access +in the presence of a single concurrent writer without any +usage of locks. In many cases, adoption of ck_queue will +simply require prefixing all queue operations with CK_. +.Sh SEE ALSO +.Xr queue +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_ring_capacity ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_ring_capacity b/lib/ck/doc/ck_ring_capacity new file mode 100644 index 0000000..0332433 --- /dev/null +++ b/lib/ck/doc/ck_ring_capacity @@ -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/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_ring_dequeue_spmc ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_ring_dequeue_spmc b/lib/ck/doc/ck_ring_dequeue_spmc new file mode 100644 index 0000000..82fc2fb --- /dev/null +++ b/lib/ck/doc/ck_ring_dequeue_spmc @@ -0,0 +1,117 @@ +.\" +.\" 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_DEQUEUE_SPMC 3 +.Sh NAME +.Nm ck_ring_dequeue_spmc +.Nd dequeue pointer from bounded FIFO +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_ring.h +.Ft bool +.Fn ck_ring_dequeue_spmc "ck_ring_t *ring" "ck_ring_buffer_t *buffer" "void *result" +.Sh DESCRIPTION +The +.Fn ck_ring_dequeue_spmc 3 +function dequeues a pointer from the bounded buffer +pointed to by +.Fa ring +in FIFO fashion. The pointer is stored in the pointer +pointed to by +.Fa result . +The buffer pointed to by +.Fa buffer +must be unique to +.Fa ring . +The decoupling of the ring from the buffer serves +to address use-cases involving multiple address spaces +and DMA, among others. +If you are on non-POSIX platforms or wish for strict +compliance with C, then it is recommended to pass a +pointer of type void ** for +.Fa result . +This function is safe to call without locking for UINT_MAX +concurrent invocations of +.Fn ck_ring_dequeue_spmc 3 +or +.Fn ck_ring_trydequeue_spmc 3 +and up to one concurrent +.Fn ck_ring_enqueue_spmc 3 +or +.Fn ck_ring_tryenqueue_spmc 3 +invocation. This function provides lock-free progress +guarantees. +.Sh EXAMPLE +.Bd -literal -offset indent +#include <ck_ring.h> + +/* This ring was previously initialized with ck_ring_init. */ +ck_ring_t ring; + +/* The ring was initialized for 1023 elements. */ +ck_ring_buffer_t buffer[1024]; + +void +dequeue(void) +{ + void *result; + + /* Dequeue from ring until it is empty. */ + while (ck_ring_dequeue_spmc(&ring, &buffer, &result) == true) { + /* + * Results contains the oldest pointer in ring + * since the dequeue operation returned true. + */ + operation(result); + } + + /* An empty ring was encountered, leave. */ + return; +} +.Ed +.Sh RETURN VALUES +The function returns true if the buffer was non-empty. +The result of the dequeue operation is stored in the +value pointed to by +.Fa result . +The function will return false if the buffer was empty +and the value in +.Fa result +will be undefined. +.Sh SEE ALSO +.Xr ck_ring_init 3 , +.Xr ck_ring_trydequeue_spmc 3 , +.Xr ck_ring_enqueue_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 , +.Xr ck_ring_size 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/ck_ring_dequeue_spsc ---------------------------------------------------------------------- diff --git a/lib/ck/doc/ck_ring_dequeue_spsc b/lib/ck/doc/ck_ring_dequeue_spsc new file mode 100644 index 0000000..75b36ac --- /dev/null +++ b/lib/ck/doc/ck_ring_dequeue_spsc @@ -0,0 +1,115 @@ +.\" +.\" 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_DEQUEUE_SPSC 3 +.Sh NAME +.Nm ck_ring_dequeue_spsc +.Nd dequeue pointer from bounded FIFO +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_ring.h +.Ft bool +.Fn ck_ring_dequeue_spsc "ck_ring_t *ring" "ck_ring_buffer_t *buffer" "void *result" +.Sh DESCRIPTION +The +.Fn ck_ring_dequeue_spsc 3 +function dequeues a pointer from the bounded buffer +pointed to by +.Fa ring +in FIFO fashion. The pointer is stored in the pointer +pointed to by +.Fa result . +The buffer pointed to by +.Fa buffer +must be unique to +.Fa ring +and point to an array of ck_ring_buffer_t of sufficient +length (according to the power-of-2 elements in the buffer). +The decoupling of the ring from the buffer serves +to address use-cases involving multiple address spaces +and DMA, among others. +If you are on non-POSIX platforms or wish for strict +compliance with C, then it is recommended to pass a +pointer of type void ** for +.Fa result . +This function is safe to call without locking for one +concurrent invocation of +.Fn ck_ring_dequeue_spsc 3 +and up to one concurrent +.Fn ck_ring_enqueue_spsc 3 +invocation. This function provides wait-free progress +guarantees. +.Sh EXAMPLE +.Bd -literal -offset indent +#include <ck_ring.h> + +/* This ring was previously initialized with ck_ring_init. */ +ck_ring_t ring; + +/* The ring was initialized for 1023 elements. */ +ck_ring_buffer_t buffer[1024]; + +void +dequeue(void) +{ + void *result; + + /* Dequeue from ring until it is empty. */ + while (ck_ring_dequeue_spsc(&ring, &buffer, &result) == true) { + /* + * Results contains the oldest pointer in ring + * since the dequeue operation returned true. + */ + operation(result); + } + + /* An empty ring was encountered, leave. */ + return; +} +.Ed +.Sh RETURN VALUES +The function returns true if the buffer was non-empty. +The result of the dequeue operation is stored in the +value pointed to by +.Fa result . +The function will return false if the buffer was empty +and the value in +.Fa result +will be undefined. +.Sh SEE ALSO +.Xr ck_ring_init 3 , +.Xr ck_ring_trydequeue_spmc 3 , +.Xr ck_ring_enqueue_spmc 3 , +.Xr ck_ring_enqueue_spmc_size 3 , +.Xr ck_ring_dequeue_spmc 3 , +.Xr ck_ring_enqueue_spsc 3 , +.Xr ck_ring_enqueue_spsc_size 3 , +.Xr ck_ring_capacity 3 , +.Xr ck_ring_size 3 +.Pp +Additional information available at http://concurrencykit.org/