commit
e0f46e6045
@ -0,0 +1,69 @@
|
||||
.\"
|
||||
.\" 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 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr
|
||||
.Nd concurrency primitives interface
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Sh DESCRIPTION
|
||||
ck_pr.h provides an interface to volatile atomic instructions,
|
||||
memory barriers and busy-wait facilities as provided by the
|
||||
underlying processor. The presence of an atomic operation
|
||||
is detected by the presence of a corresponding CK_F_PR macro.
|
||||
For example, the availability of
|
||||
.Xr ck_pr_add_16 3
|
||||
would be determined by the presence of CK_F_PR_ADD_16.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_pr_stall 3 ,
|
||||
.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/
|
@ -0,0 +1,85 @@
|
||||
.\"
|
||||
.\" 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_add 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_add
|
||||
.Nd atomic addition operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void
|
||||
.Fn ck_pr_add_ptr "void *target" "uintptr_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_double "double *target" "double delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_char "char *target" "char delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_uint "unsigned int *target" "unsigned int delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_int "int *target" "int delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_64 "uint64_t *target" "uint64_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_32 "uint32_t *target" "uint32_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_16 "uint16_t *target" "uint16_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_add_8 "uint8_t *target" "uint8_t delta"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_add 3
|
||||
family of functions atomically add the value specified by
|
||||
.Fa delta
|
||||
to 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_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/
|
@ -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 11, 2013
|
||||
.Dt ck_pr_and 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_and
|
||||
.Nd atomic bitwise-and operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void
|
||||
.Fn ck_pr_and_ptr "void *target" "uintptr_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_char "char *target" "char delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_uint "unsigned int *target" "unsigned int delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_int "int *target" "int delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_64 "uint64_t *target" "uint64_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_32 "uint32_t *target" "uint32_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_16 "uint16_t *target" "uint16_t delta"
|
||||
.Ft void
|
||||
.Fn ck_pr_and_8 "uint8_t *target" "uint8_t delta"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_and 3
|
||||
family of functions atomically compute and store the
|
||||
result of a bitwise-and 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_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/
|
@ -0,0 +1,66 @@
|
||||
.\"
|
||||
.\" 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_barrier 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_barrier
|
||||
.Nd compiler optimization barrier
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void
|
||||
.Fn ck_pr_barrier void
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_barrier 3
|
||||
function is used to disable code movement optimizations
|
||||
across the invocation of the function.
|
||||
.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_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/
|
@ -0,0 +1,85 @@
|
||||
.\"
|
||||
.\" 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_btc 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_btc
|
||||
.Nd atomic bit test-and-complement operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft bool
|
||||
.Fn ck_pr_btc_ptr "void *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btc_uint "uint *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btc_int "int *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btc_64 "uint64_t *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btc_32 "uint32_t *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btc_16 "uint16_t *target" "unsigned int bit_index"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_btc 3
|
||||
family of functions atomically fetch the value
|
||||
of the bit in
|
||||
.Fa target
|
||||
at index
|
||||
.Fa bit_index
|
||||
and set that bit to its complement.
|
||||
.Sh RETURN VALUES
|
||||
These family of functions return the original value of
|
||||
the bit at offset
|
||||
.Fa bit_index
|
||||
that is in the value pointed to by
|
||||
.Fa target .
|
||||
.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_btr 3 ,
|
||||
.Xr ck_pr_cas 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
@ -0,0 +1,85 @@
|
||||
.\"
|
||||
.\" 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_btr 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_btr
|
||||
.Nd atomic bit test-and-reset operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft bool
|
||||
.Fn ck_pr_btr_ptr "void *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btr_uint "uint *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btr_int "int *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btr_64 "uint64_t *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btr_32 "uint32_t *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_btr_16 "uint16_t *target" "unsigned int bit_index"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_btr 3
|
||||
family of functions atomically fetch the value
|
||||
of the bit in
|
||||
.Fa target
|
||||
at index
|
||||
.Fa bit_index
|
||||
and set that bit to 0.
|
||||
.Sh RETURN VALUES
|
||||
This family of functions returns the original value of
|
||||
the bit at offset
|
||||
.Fa bit_index
|
||||
that is in the value pointed to by
|
||||
.Fa target .
|
||||
.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_cas 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
@ -0,0 +1,85 @@
|
||||
.\"
|
||||
.\" 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_bts 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_bts
|
||||
.Nd atomic bit test-and-set operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft bool
|
||||
.Fn ck_pr_bts_ptr "void *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_bts_uint "uint *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_bts_int "int *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_bts_64 "uint64_t *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_bts_32 "uint32_t *target" "unsigned int bit_index"
|
||||
.Ft bool
|
||||
.Fn ck_pr_bts_16 "uint16_t *target" "unsigned int bit_index"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_bts 3
|
||||
family of functions atomically fetch the value
|
||||
of the bit in
|
||||
.Fa target
|
||||
at index
|
||||
.Fa bit_index
|
||||
and set that bit to 1.
|
||||
.Sh RETURN VALUES
|
||||
This family of functions returns the original value of
|
||||
the bit at offset
|
||||
.Fa bit_index
|
||||
that is in the value pointed to by
|
||||
.Fa target .
|
||||
.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_btr 3 ,
|
||||
.Xr ck_pr_cas 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
@ -0,0 +1,130 @@
|
||||
.\"
|
||||
.\" 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_cas 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_cas
|
||||
.Nd atomic compare-and-swap operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_ptr "void *target" "void *old_value" "void *new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_ptr_value "void *target" "void *old_value" "void *new_value" "void *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_ptr_2 "void *target" "void *old_value" "void *new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_ptr_2_value "void *target" "void *old_value" "void *new_value" "void *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_double "double *target" "double old_value" "double new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_double_value "double *target" "double old_value" "double new_value" "double *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_char "char *target" "char old_value" "char new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_char_value "char *target" "char old_value" "char new_value" "char *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_uint "unsigned int *target" "unsigned int old_value" "unsigned int new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_uint_value "unsigned int *target" "unsigned int old_value" "unsigned int new_value" "unsigned int *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_int "int *target" "int old_value" "int new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_int_value "int *target" "int old_value" "int new_value" "int *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_64_2 "uint64_t target[static 2]" "uint64_t old_value[static 2]" "uint64_t new_value[static 2]"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_64_2_value "uint64_t target[static 2]" "uint64_t old_value[static 2]" "uint64_t new_value[static 2]" "uint64_t original_value[static 2]"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_64 "uint64_t *target" "uint64_t old_value" "uint64_t new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_64_value "uint64_t *target" "uint64_t old_value" "uint64_t new_value" "uint64_t *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_64_2 "uint64_t target[static 2]" "uint64_t old_value[static 2]" "uint64_t new_value[static 2]"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_64_2_value "uint64_t target[static 2]" "uint64_t old_value[static 2]" "uint64_t new_value[static 2]" "uint64_t original_value[static 2]"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_32 "uint32_t *target" "uint32_t old_value" "uint32_t new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_32_value "uint32_t *target" "uint32_t old_value" "uint32_t new_value" "uint32_t *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_16 "uint16_t *target" "uint16_t old_value" "uint16_t new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_16_value "uint16_t *target" "uint16_t old_value" "uint16_t new_value" "uint16_t *original_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_8 "uint8_t *target" "uint8_t old_value" "uint8_t new_value"
|
||||
.Ft bool
|
||||
.Fn ck_pr_cas_8_value "uint8_t *target" "uint8_t old_value" "uint8_t new_value" "uint8_t *original_value"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_cas 3
|
||||
family of functions atomically compare the value in
|
||||
.Fa target
|
||||
for equality with
|
||||
.Fa old_value
|
||||
and if so, replace the value pointed to by
|
||||
.Fa target
|
||||
with the value specified by
|
||||
.Fa original_value .
|
||||
If the value in
|
||||
.Fa target
|
||||
was not equal to the value specified by
|
||||
.Fa old_value
|
||||
then no modifications occur to the value in
|
||||
.Fa target .
|
||||
The *_value form of these functions unconditionally update
|
||||
.Fa original_value .
|
||||
.Sh RETURN VALUES
|
||||
This family of functions return true if the value in
|
||||
.Fa target
|
||||
was modified as a result of the operation. Otherwise, they
|
||||
return false.
|
||||
.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/
|
@ -0,0 +1,104 @@
|
||||
.\"
|
||||
.\" 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_dec 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_dec
|
||||
.Nd atomic decrement operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_ptr "void *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_ptr_zero "void *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_double "double *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_double_zero "double *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_char "char *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_char_zero "char *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_uint "unsigned int *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_uint_zero "unsigned int *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_int "int *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_int_zero "int *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_64 "uint64_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_64_zero "uint64_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_32 "uint32_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_32_zero "uint32_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_16 "uint16_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_16_zero "uint16_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_dec_8 "uint8_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_dec_8_zero "uint8_t *target"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_dec 3
|
||||
family of functions atomically decrement the value pointed to
|
||||
by
|
||||
.Fa target .
|
||||
.Sh RETURN VALUES
|
||||
The ck_pr_dec_zero family of functions returns true if the result
|
||||
of the decrement operation was 0. They return
|
||||
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_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/
|
@ -0,0 +1,91 @@
|
||||
.\"
|
||||
.\" 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_faa 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_faa
|
||||
.Nd atomic fetch-and-add operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft uintptr_t
|
||||
.Fn ck_pr_faa_ptr "void *target" "uintptr_t delta"
|
||||
.Ft double
|
||||
.Fn ck_pr_faa_double "double *target" "double delta"
|
||||
.Ft char
|
||||
.Fn ck_pr_faa_char "char *target" "char delta"
|
||||
.Ft unsigned int
|
||||
.Fn ck_pr_faa_uint "unsigned int *target" "unsigned int delta"
|
||||
.Ft int
|
||||
.Fn ck_pr_faa_int "int *target" "int delta"
|
||||
.Ft uint64_t
|
||||
.Fn ck_pr_faa_64 "uint64_t *target" "uint64_t delta"
|
||||
.Ft uint32_t
|
||||
.Fn ck_pr_faa_32 "uint32_t *target" "uint32_t delta"
|
||||
.Ft uint16_t
|
||||
.Fn ck_pr_faa_16 "uint16_t *target" "uint16_t delta"
|
||||
.Ft uint8_t
|
||||
.Fn ck_pr_faa_8 "uint8_t *target" "uint8_t delta"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_faa 3
|
||||
family of functions atomically fetch the value pointed to
|
||||
by
|
||||
.Fa target
|
||||
and add the value specified by
|
||||
.Fa delta
|
||||
to the value pointed to by
|
||||
.Fa target .
|
||||
.Sh RETURN VALUES
|
||||
This function returns the value pointed to by
|
||||
.Fa target
|
||||
at the time of operation invocation before the
|
||||
addition operation is applied.
|
||||
.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_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/
|
@ -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_fas 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_fas
|
||||
.Nd atomic swap operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void *
|
||||
.Fn ck_pr_fas_ptr "void *target" "void *new_value"
|
||||
.Ft double
|
||||
.Fn ck_pr_fas_double "double *target" "double new_value"
|
||||
.Ft char
|
||||
.Fn ck_pr_fas_char "char *target" "char new_value"
|
||||
.Ft unsigned int
|
||||
.Fn ck_pr_fas_uint "unsigned int *target" "unsigned int new_value"
|
||||
.Ft int
|
||||
.Fn ck_pr_fas_int "int *target" "int new_value"
|
||||
.Ft uint64_t
|
||||
.Fn ck_pr_fas_64 "uint64_t *target" "uint64_t new_value"
|
||||
.Ft uint32_t
|
||||
.Fn ck_pr_fas_32 "uint32_t *target" "uint32_t new_value"
|
||||
.Ft uint16_t
|
||||
.Fn ck_pr_fas_16 "uint16_t *target" "uint16_t new_value"
|
||||
.Ft uint8_t
|
||||
.Fn ck_pr_fas_8 "uint8_t *target" "uint8_t new_value"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_pr_fas 3
|
||||
family of functions atomically fetch the value pointed to
|
||||
by
|
||||
.Fa target
|
||||
and replace the value pointed to by
|
||||
.Fa target
|
||||
with the value specified by
|
||||
.Fa new_value .
|
||||
.Sh RETURN VALUES
|
||||
This function returns the value pointed to by
|
||||
.Fa target
|
||||
at the time of operation invocation before it was
|
||||
atomically replaced with
|
||||
.Fa new_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_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/
|
@ -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 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_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/
|
@ -0,0 +1,70 @@
|
||||
.\"
|
||||
.\" 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_load 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/
|
@ -0,0 +1,110 @@
|
||||
.\"
|
||||
.\" 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_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/
|
@ -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 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_load 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/
|
@ -0,0 +1,104 @@
|
||||
.\"
|
||||
.\" 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
|
||||
.Nd atomic increment operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_ptr "void *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_ptr_zero "void *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_double "double *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_double_zero "double *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_char "char *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_char_zero "char *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_uint "unsigned int *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_uint_zero "unsigned int *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_int "int *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_int_zero "int *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_64 "uint64_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_64_zero "uint64_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_32 "uint32_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_32_zero "uint32_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_16 "uint16_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_16_zero "uint16_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_inc_8 "uint8_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_inc_8_zero "uint8_t *target"
|
||||
.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 return true
|
||||
if the result of the increment operation was 0. The functions return
|
||||
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/
|
@ -0,0 +1,88 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Samy Al Bahra.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd April 15, 2013
|
||||
.Dt ck_pr_load 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_load
|
||||
.Nd atomic volatile load operation
|
||||
.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/
|
@ -0,0 +1,103 @@
|
||||
.\"
|
||||
.\" 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
|
||||
.Nd atomic negation operation
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_pr.h
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_ptr "void *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_ptr_zero "void *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_double "double *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_double_zero "double *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_char "char *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_char_zero "char *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_uint "unsigned int *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_uint_zero "unsigned int *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_int "int *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_int_zero "int *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_64 "uint64_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_64_zero "uint64_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_32 "uint32_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_32_zero "uint32_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_16 "uint16_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_16_zero "uint16_t *target"
|
||||
.Ft void
|
||||
.Fn ck_pr_neg_8 "uint8_t *target"
|
||||
.Ft bool
|
||||
.Fn ck_pr_neg_8_zero "uint8_t *target"
|
||||
.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 return true if the result
|
||||
of the negation operation was 0. They return 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/
|
@ -0,0 +1,84 @@
|
||||
.\"
|
||||
.\" 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
|
||||
.Nd atomic complement operation
|
||||
.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/
|
@ -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 11, 2013
|
||||
.Dt ck_pr_or 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_or
|
||||
.Nd atomic bitwise-or operation
|
||||
.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/
|
@ -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/
|
@ -0,0 +1,88 @@
|
||||
.\"
|
||||
.\" Copyright 2013 Samy Al Bahra.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd April 15, 2013
|
||||
.Dt ck_pr_store 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_store
|
||||
.Nd atomic volatile store operation
|
||||
.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/
|
@ -0,0 +1,85 @@
|
||||
.\"
|
||||
.\" 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
|
||||
.Nd atomic subtraction operation
|
||||
.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/
|
@ -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 11, 2013
|
||||
.Dt ck_pr_xor 3
|
||||
.Sh NAME
|
||||
.Nm ck_pr_xor
|
||||
.Nd atomic bitwise-xor operation
|
||||
.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/
|
@ -0,0 +1,107 @@
|
||||
.\"
|
||||
.\" 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" "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 .
|
||||
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;
|
||||
|
||||
void
|
||||
dequeue(void)
|
||||
{
|
||||
void *result;
|
||||
|
||||
/* Dequeue from ring until it is empty. */
|
||||
while (ck_ring_dequeue_spmc(&ring, &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/
|
@ -0,0 +1,103 @@
|
||||
.\"
|
||||
.\" 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" "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 .
|
||||
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;
|
||||
|
||||
void
|
||||
dequeue(void)
|
||||
{
|
||||
void *result;
|
||||
|
||||
/* Dequeue from ring until it is empty. */
|
||||
while (ck_ring_dequeue_spsc(&ring, &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/
|
@ -0,0 +1,103 @@
|
||||
.\"
|
||||
.\" 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_ENQUEUE_SPMC 3
|
||||
.Sh NAME
|
||||
.Nm ck_ring_enqueue_spmc
|
||||
.Nd enqueue pointer into bounded FIFO
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ring.h
|
||||
.Ft bool
|
||||
.Fn ck_ring_enqueue_spmc "ck_ring_t *ring" "void *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ring_enqueue_spmc 3
|
||||
function enqueues the pointer
|
||||
.Fa entry
|
||||
into the bounded buffer pointed to by
|
||||
.Fa ring
|
||||
in FIFO fashion.
|
||||
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 entry .
|
||||
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 .
|
||||
This function provides wait-free progress
|
||||
guarantees for one active invocation.
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
#include <ck_ring.h>
|
||||
|
||||
/* This ring was previously initialized with ck_ring_init. */
|
||||
ck_ring_t ring;
|
||||
|
||||
void
|
||||
enqueue(void)
|
||||
{
|
||||
void *entry = some_object;
|
||||
|
||||
/* Attempt to enqueue pointer to some_object into buffer. */
|
||||
if (ck_ring_enqueue_spmc(&ring, &entry) == false) {
|
||||
/*
|
||||
* The buffer was full and the enqueue operation
|
||||
* has failed.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/* Enqueue operation completed successfully. */
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
The function returns true if the value of
|
||||
.Fa entry
|
||||
was successfully enqueued into
|
||||
.Fa ring .
|
||||
The function will return false if the value of
|
||||
.Fa entry
|
||||
could not be enqueued which only occurs if
|
||||
.Fa ring
|
||||
was full.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ring_init 3 ,
|
||||
.Xr ck_ring_dequeue_spmc 3 ,
|
||||
.Xr ck_ring_trydequeue_spmc 3 ,
|
||||
.Xr ck_ring_enqueue_spmc_size 3 ,
|
||||
.Xr ck_ring_dequeue_spsc 3 ,
|
||||
.Xr ck_ring_enqueue_spsc 3 ,
|
||||
.Xr ck_ring_enqueue_spsc_size 3 ,
|
||||
.Xr ck_ring_capacity 3 ,
|
||||
.Xr ck_ring_size 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
@ -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_ENQUEUE_SPMC_SIZE 3
|
||||
.Sh NAME
|
||||
.Nm ck_ring_enqueue_spmc_size
|
||||
.Nd enqueue pointer into bounded FIFO and return size of buffer
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ring.h
|
||||
.Ft bool
|
||||
.Fn ck_ring_enqueue_spmc_size "ck_ring_t *ring" "void *entry" "unsigned int *length"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ring_enqueue_spmc 3
|
||||
function enqueues the pointer
|
||||
.Fa entry
|
||||
into the bounded buffer pointed to by
|
||||
.Fa ring
|
||||
in FIFO fashion.
|
||||
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 entry .
|
||||
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 .
|
||||
This function provides wait-free progress
|
||||
guarantees for one active invocation.
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
#include <ck_ring.h>
|
||||
|
||||
/* This ring was previously initialized with ck_ring_init. */
|
||||
ck_ring_t ring;
|
||||
|
||||
void
|
||||
enqueue(void)
|
||||
{
|
||||
void *entry = some_object;
|
||||
unsigned int length;
|
||||
|
||||
/* Attempt to enqueue pointer to some_object into buffer. */
|
||||
if (ck_ring_enqueue_spmc_size(&ring, &entry, &length) == false) {
|
||||
/*
|
||||
* The buffer was full and the enqueue operation
|
||||
* has failed.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If entry was the 101st or greater pointer in the buffer,
|
||||
* do something.
|
||||
*/
|
||||
if (length > 100) {
|
||||
do_something;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
The function returns true if the value of
|
||||
.Fa entry
|
||||
was successfully enqueued into
|
||||
.Fa ring .
|
||||
The function will return false if the value of
|
||||
.Fa entry
|
||||
could not be enqueued which only occurs if
|
||||
.Fa ring
|
||||
was full. The number of entries in the buffer
|
||||
with respect to the point in time that
|
||||
.Fa entry
|
||||
is enqueued is stored in the integer pointed to by
|
||||
.Fa length .
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ring_init 3 ,
|
||||
.Xr ck_ring_dequeue_spmc 3 ,
|
||||
.Xr ck_ring_trydequeue_spmc 3 ,
|
||||
.Xr ck_ring_enqueue_spmc 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/
|
@ -0,0 +1,101 @@
|
||||
.\"
|
||||
.\" 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_ENQUEUE_SPSC 3
|
||||
.Sh NAME
|
||||
.Nm ck_ring_enqueue_spsc
|
||||
.Nd enqueue pointer into bounded FIFO
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ring.h
|
||||
.Ft bool
|
||||
.Fn ck_ring_enqueue_spsc "ck_ring_t *ring" "void *entry"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ring_enqueue_spsc 3
|
||||
function enqueues the pointer
|
||||
.Fa entry
|
||||
into the bounded buffer pointed to by
|
||||
.Fa ring
|
||||
in FIFO fashion.
|
||||
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 entry .
|
||||
This function is safe to call without locking for up to
|
||||
one concurrent invocation of
|
||||
.Fn ck_ring_dequeue_spsc 3 .
|
||||
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;
|
||||
|
||||
void
|
||||
enqueue(void)
|
||||
{
|
||||
void *entry = some_object;
|
||||
|
||||
/* Attempt to enqueue pointer to some_object into buffer. */
|
||||
if (ck_ring_enqueue_spsc(&ring, &entry) == false) {
|
||||
/*
|
||||
* The buffer was full and the enqueue operation
|
||||
* has failed.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/* Enqueue operation completed successfully. */
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
The function returns true if the value of
|
||||
.Fa entry
|
||||
was successfully enqueued into
|
||||
.Fa ring .
|
||||
The function will return false if the value of
|
||||
.Fa entry
|
||||
could not be enqueued which only occurs if
|
||||
.Fa ring
|
||||
was full.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ring_init 3 ,
|
||||
.Xr ck_ring_dequeue_spmc 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_size 3 ,
|
||||
.Xr ck_ring_capacity 3 ,
|
||||
.Xr ck_ring_size 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
@ -0,0 +1,116 @@
|
||||
.\"
|
||||
.\" 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_ENQUEUE_SPSC_SIZE 3
|
||||
.Sh NAME
|
||||
.Nm ck_ring_enqueue_spsc_size
|
||||
.Nd enqueue pointer into bounded FIFO and return size of buffer
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ring.h
|
||||
.Ft bool
|
||||
.Fn ck_ring_enqueue_spsc_size "ck_ring_t *ring" "void *entry" "unsigned int *size"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ring_enqueue_spsc_size 3
|
||||
function enqueues the pointer
|
||||
.Fa entry
|
||||
into the bounded buffer pointed to by
|
||||
.Fa ring
|
||||
in FIFO fashion.
|
||||
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 entry .
|
||||
This function is safe to call without locking for up to
|
||||
one concurrent invocation of
|
||||
.Fn ck_ring_dequeue_spsc 3 .
|
||||
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;
|
||||
|
||||
void
|
||||
enqueue(void)
|
||||
{
|
||||
void *entry = some_object;
|
||||
unsigned int length;
|
||||
|
||||
/* Attempt to enqueue pointer to some_object into buffer. */
|
||||
if (ck_ring_enqueue_spsc(&ring, &entry, &length) == false) {
|
||||
/*
|
||||
* The buffer was full and the enqueue operation
|
||||
* has failed.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If buffer length was 100 items or more at the time entry was
|
||||
* enqueued, do something.
|
||||
*/
|
||||
if (length > 100) {
|
||||
do_something;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
.Ed
|
||||
.Sh RETURN VALUES
|
||||
The function returns true if the value of
|
||||
.Fa entry
|
||||
was successfully enqueued into
|
||||
.Fa ring .
|
||||
This function will return the number of items
|
||||
in
|
||||
.Fa ring
|
||||
with respect to the linearization point (the
|
||||
point in item that
|
||||
.Fa entry
|
||||
is enqueued).
|
||||
The function will return false if the value of
|
||||
.Fa entry
|
||||
could not be enqueued which only occurs if
|
||||
.Fa ring
|
||||
was full.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ring_init 3 ,
|
||||
.Xr ck_ring_dequeue_spmc 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_capacity 3 ,
|
||||
.Xr ck_ring_size 3
|
||||
.Pp
|
||||
Additional information available at http://concurrencykit.org/
|
@ -0,0 +1,66 @@
|
||||
.\"
|
||||
.\" 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_INIT 3
|
||||
.Sh NAME
|
||||
.Nm ck_ring_init
|
||||
.Nd initialize bounded FIFO
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ring.h
|
||||
.Ft void
|
||||
.Fn ck_ring_init "ck_ring_t *ring" "void *buffer" "unsigned int size"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ring_init
|
||||
function initializes a bounded FIFO buffer pointed to by
|
||||
.Fa ring
|
||||
for the storage of up to
|
||||
.Fa size
|
||||
number of pointers. The
|
||||
.Fa buffer
|
||||
argument must be a pointer to an array of void * of
|
||||
length
|
||||
.Fa size .
|
||||
The
|
||||
.Fa size
|
||||
argument must be a power-of-two greater than or equal to 4.
|
||||
.Sh RETURN VALUES
|
||||
This function has no return value.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ring_dequeue_spmc 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/
|
@ -0,0 +1,114 @@
|
||||
.\"
|
||||
.\" 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_TRYDEQUEUE_SPMC 3
|
||||
.Sh NAME
|
||||
.Nm ck_ring_trydequeue_spmc
|
||||
.Nd dequeue from bounded FIFO and allow for spurious failure
|
||||
.Sh LIBRARY
|
||||
Concurrency Kit (libck, \-lck)
|
||||
.Sh SYNOPSIS
|
||||
.In ck_ring.h
|
||||
.Ft bool
|
||||
.Fn ck_ring_trydequeue_spmc "ck_ring_t *ring" "void *result"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn ck_ring_trydequeue_spmc 3
|
||||
function attempts to dequeue 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 .
|
||||
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
|
||||
.Fn ck_ring_dequeue_spmc 3
|
||||
or
|
||||
.Fn ck_ring_trydequeue_spmc 3
|
||||
invocations and up to one concurrent
|
||||
.Fn ck_ring_enqueue_spmc 3
|
||||
or
|
||||
.Fn ck_ring_tryenqueue_spmc 3
|
||||
invocation. This operation will always complete
|
||||
in a bounded number of steps. It is
|
||||
possible for the function to return false even
|
||||
if
|
||||
.Fa ring
|
||||
is non-empty. This
|
||||
.Sh EXAMPLE
|
||||
.Bd -literal -offset indent
|
||||
#include <ck_ring.h>
|
||||
|
||||
/* This ring was previously initialized with ck_ring_init. */
|
||||
ck_ring_t ring;
|
||||
|
||||
void
|
||||
dequeue(void)
|
||||
{
|
||||
void *result;
|
||||
|
||||
/* Dequeue from ring until contention is actively observed. */
|
||||
while (ck_ring_trydequeue_spmc(&ring, &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 dequeue operation
|
||||
completely successfully in a bounded number of steps.
|
||||
The result of the dequeue operation is stored in the
|
||||
value pointed to by
|
||||
.Fa result .
|
||||
Otherwise, the function will return false if the buffer was empty
|
||||
or if the operation could not be completed in a bounded
|
||||
number of steps. If the function returns false, then the contents
|
||||
of
|
||||
.Fa result
|
||||
are undefined.
|
||||
.Sh SEE ALSO
|
||||
.Xr ck_ring_init 3 ,
|
||||
.Xr ck_ring_dequeue_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/
|
@ -1,22 +1,26 @@
|
||||
.PHONY: check clean distribution
|
||||
|
||||
HEADER=../../../include/ck_queue.h
|
||||
OBJECTS=ck_slist ck_list
|
||||
OBJECTS=ck_list ck_slist ck_stailq
|
||||
|
||||
all: $(OBJECTS)
|
||||
|
||||
check: all
|
||||
./ck_slist $(CORES) 100000
|
||||
./ck_list $(CORES) 100000
|
||||
./ck_list $(CORES) 5
|
||||
./ck_slist $(CORES) 5
|
||||
./ck_stailq $(CORES) 1000000
|
||||
|
||||
ck_list: $(HEADER) ck_list.c
|
||||
$(CC) $(CFLAGS) -o ck_list ck_list.c
|
||||
|
||||
ck_slist: $(HEADER) ck_slist.c
|
||||
$(CC) $(CFLAGS) -o ck_slist ck_slist.c
|
||||
|
||||
ck_list: $(HEADER) ck_list.c
|
||||
$(CC) $(CFLAGS) -o ck_list ck_list.c
|
||||
ck_stailq: $(HEADER) ck_stailq.c
|
||||
$(CC) $(CFLAGS) -o ck_stailq ck_stailq.c
|
||||
|
||||
clean:
|
||||
rm -rf *~ *.o $(OBJECTS) *.dSYM
|
||||
rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe
|
||||
|
||||
include ../../../build/regressions.build
|
||||
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE
|
||||
|
@ -0,0 +1,256 @@
|
||||
/*
|
||||
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
#include <ck_queue.h>
|
||||
#include "../../common.h"
|
||||
|
||||
struct test {
|
||||
int value;
|
||||
CK_STAILQ_ENTRY(test) list_entry;
|
||||
};
|
||||
static CK_STAILQ_HEAD(test_list, test) head = CK_STAILQ_HEAD_INITIALIZER(head);
|
||||
|
||||
static int goal;
|
||||
|
||||
static void
|
||||
test_foreach(void)
|
||||
{
|
||||
struct test *n, *next, *safe;
|
||||
int i, s = 0, j = 0, k = 0;
|
||||
|
||||
for (i = goal; i != 0; i = goal) {
|
||||
s = 0;
|
||||
|
||||
CK_STAILQ_FOREACH(n, &head, list_entry) {
|
||||
j++;
|
||||
if (s == 0)
|
||||
s = n->value;
|
||||
else
|
||||
s = s - 1;
|
||||
|
||||
if (n->value != s) {
|
||||
ck_error("\nExpected %d, but got %d.\n",
|
||||
s, n->value);
|
||||
}
|
||||
|
||||
next = CK_STAILQ_NEXT(n, list_entry);
|
||||
if (next != NULL && next->value != s - 1) {
|
||||
ck_error("\nExpected %d, but got %d.\n",
|
||||
s, next->value);
|
||||
}
|
||||
|
||||
i--;
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
break;
|
||||
|
||||
s = 0;
|
||||
CK_STAILQ_FOREACH_SAFE(n, &head, list_entry, safe) {
|
||||
k++;
|
||||
|
||||
if (s == 0)
|
||||
s = n->value;
|
||||
else
|
||||
s = s - 1;
|
||||
|
||||
if (n->value != s) {
|
||||
ck_error("\nExpected %d, but got %d.\n",
|
||||
s, n->value);
|
||||
}
|
||||
|
||||
next = CK_STAILQ_NEXT(n, list_entry);
|
||||
if (next != NULL && next->value != s - 1) {
|
||||
ck_error("\nExpected %d, but got %d.\n",
|
||||
s, next->value);
|
||||
}
|
||||
|
||||
i--;
|
||||
}
|
||||
|
||||
if (i == 0 || CK_STAILQ_EMPTY(&head) == true)
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "(%d, %d) ", j, k);
|
||||
return;
|
||||
}
|
||||
|
||||
static void *
|
||||
execute(void *c)
|
||||
{
|
||||
|
||||
(void)c;
|
||||
test_foreach();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
pthread_t *thread;
|
||||
struct test *n, a, b;
|
||||
struct test_list target;
|
||||
int n_threads, i;
|
||||
|
||||
if (argc != 3) {
|
||||
ck_error("Usage: %s <number of threads> <number of list entries>\n", argv[0]);
|
||||
}
|
||||
|
||||
n_threads = atoi(argv[1]);
|
||||
if (n_threads < 1) {
|
||||
ck_error("ERROR: Number of threads must be >= 1.\n");
|
||||
}
|
||||
|
||||
thread = malloc(sizeof(pthread_t) * n_threads);
|
||||
assert(thread != NULL);
|
||||
|
||||
goal = atoi(argv[2]);
|
||||
if (goal < 4) {
|
||||
ck_error("ERROR: Number of entries must be >= 4.\n");
|
||||
}
|
||||
|
||||
fprintf(stderr, "Beginning serial test...");
|
||||
CK_STAILQ_INIT(&head);
|
||||
|
||||
for (i = 1; i <= goal; i++) {
|
||||
n = malloc(sizeof *n);
|
||||
assert(n != NULL);
|
||||
n->value = i;
|
||||
CK_STAILQ_INSERT_HEAD(&head, n, list_entry);
|
||||
}
|
||||
|
||||
test_foreach();
|
||||
|
||||
for (i = 1; i <= goal; i++) {
|
||||
n = CK_STAILQ_FIRST(&head);
|
||||
CK_STAILQ_REMOVE(&head, n, test, list_entry);
|
||||
free(n);
|
||||
}
|
||||
|
||||
if (CK_STAILQ_EMPTY(&head) == false) {
|
||||
ck_error("List is not empty after bulk removal.\n");
|
||||
}
|
||||
|
||||
for (i = 1; i <= goal; i++) {
|
||||
n = malloc(sizeof *n);
|
||||
assert(n != NULL);
|
||||
n->value = goal - i;
|
||||
CK_STAILQ_INSERT_TAIL(&head, n, list_entry);
|
||||
}
|
||||
|
||||
test_foreach();
|
||||
|
||||
for (i = 1; i <= goal; i++) {
|
||||
n = CK_STAILQ_FIRST(&head);
|
||||
CK_STAILQ_REMOVE(&head, n, test, list_entry);
|
||||
free(n);
|
||||
}
|
||||
|
||||
if (CK_STAILQ_EMPTY(&head) == false) {
|
||||
ck_error("List is not empty after bulk removal.\n");
|
||||
}
|
||||
|
||||
CK_STAILQ_INSERT_HEAD(&head, &a, list_entry);
|
||||
CK_STAILQ_INSERT_HEAD(&head, &b, list_entry);
|
||||
CK_STAILQ_REMOVE(&head, &a, test, list_entry);
|
||||
if (CK_STAILQ_FIRST(&head) != &b)
|
||||
ck_error("List is in invalid state.\n");
|
||||
CK_STAILQ_REMOVE(&head, &b, test, list_entry);
|
||||
|
||||
if (CK_STAILQ_EMPTY(&head) == false) {
|
||||
ck_error("List is not empty after bulk removal.\n");
|
||||
}
|
||||
|
||||
CK_STAILQ_INSERT_HEAD(&head, &a, list_entry);
|
||||
CK_STAILQ_INSERT_AFTER(&head, &a, &b, list_entry);
|
||||
|
||||
if (CK_STAILQ_NEXT(&b, list_entry) != NULL)
|
||||
ck_error("Inserted item after last, it should not have no next.\n");
|
||||
|
||||
CK_STAILQ_INIT(&head);
|
||||
|
||||
CK_STAILQ_INSERT_HEAD(&head, &a, list_entry);
|
||||
if (CK_STAILQ_NEXT(&a, list_entry) != NULL)
|
||||
ck_error("Inserted item as last, but it contains next pointer.\n");
|
||||
|
||||
CK_STAILQ_INIT(&head);
|
||||
fprintf(stderr, "done (success)\n");
|
||||
|
||||
fprintf(stderr, "Beginning parallel traversal...");
|
||||
|
||||
n = malloc(sizeof *n);
|
||||
assert(n != NULL);
|
||||
n->value = 1;
|
||||
CK_STAILQ_INSERT_HEAD(&head, n, list_entry);
|
||||
|
||||
for (i = 0; i < n_threads; i++) {
|
||||
int r = pthread_create(&thread[i], NULL, execute, NULL);
|
||||
assert(r == 0);
|
||||
}
|
||||
|
||||
for (i = 2; i <= goal; i++) {
|
||||
volatile int j;
|
||||
|
||||
n = malloc(sizeof *n);
|
||||
assert(n != NULL);
|
||||
n->value = i;
|
||||
CK_STAILQ_INSERT_HEAD(&head, n, list_entry);
|
||||
for (j = 0; j <= 1000; j++);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_threads; i++)
|
||||
pthread_join(thread[i], NULL);
|
||||
|
||||
for (i = 0; i < n_threads; i++) {
|
||||
int r = pthread_create(&thread[i], NULL, execute, NULL);
|
||||
assert(r == 0);
|
||||
}
|
||||
|
||||
CK_STAILQ_MOVE(&target, &head, list_entry);
|
||||
|
||||
for (i = 1; i <= goal; i++) {
|
||||
volatile int j;
|
||||
|
||||
if (CK_STAILQ_EMPTY(&target) == false) {
|
||||
struct test *r = CK_STAILQ_FIRST(&target);
|
||||
CK_STAILQ_REMOVE(&target, r, test, list_entry);
|
||||
}
|
||||
|
||||
for (j = 0; j <= 1000; j++);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_threads; i++)
|
||||
pthread_join(thread[i], NULL);
|
||||
|
||||
fprintf(stderr, "done (success)\n");
|
||||
return (0);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue