TS-2950: Initial commit of libck.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f098175e Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f098175e Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f098175e Branch: refs/heads/master Commit: f098175e9620743ab632f0fa23104f6498d45d44 Parents: f5a3d5a Author: Phil Sorber <sor...@apache.org> Authored: Fri Aug 1 14:41:51 2014 -0600 Committer: Phil Sorber <sor...@apache.org> Committed: Fri Aug 1 14:44:01 2014 -0600 ---------------------------------------------------------------------- lib/ck/.gitignore | 178 +++ lib/ck/LICENSE | 54 + lib/ck/Makefile.in | 103 ++ lib/ck/README | 21 + lib/ck/build/ck.build.aarch64 | 1 + lib/ck/build/ck.build.arm | 1 + lib/ck/build/ck.build.in | 10 + lib/ck/build/ck.build.ppc | 1 + lib/ck/build/ck.build.ppc64 | 1 + lib/ck/build/ck.build.sparcv9 | 1 + lib/ck/build/ck.build.x86 | 1 + lib/ck/build/ck.build.x86_64 | 1 + lib/ck/build/ck.pc.in | 10 + lib/ck/build/ck.spec.in | 74 + lib/ck/build/regressions.build.in | 10 + lib/ck/configure | 708 ++++++++++ lib/ck/doc/CK_ARRAY_FOREACH | 79 ++ lib/ck/doc/CK_COHORT_INIT | 66 + lib/ck/doc/CK_COHORT_INSTANCE | 59 + lib/ck/doc/CK_COHORT_LOCK | 61 + lib/ck/doc/CK_COHORT_PROTOTYPE | 76 + lib/ck/doc/CK_COHORT_TRYLOCK | 69 + lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE | 90 ++ lib/ck/doc/CK_COHORT_UNLOCK | 61 + lib/ck/doc/CK_HS_HASH | 71 + lib/ck/doc/CK_RWCOHORT_INIT | 61 + lib/ck/doc/CK_RWCOHORT_INSTANCE | 64 + lib/ck/doc/CK_RWCOHORT_PROTOTYPE | 65 + lib/ck/doc/CK_RWCOHORT_READ_LOCK | 66 + lib/ck/doc/CK_RWCOHORT_READ_UNLOCK | 65 + lib/ck/doc/CK_RWCOHORT_WRITE_LOCK | 66 + lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK | 65 + lib/ck/doc/Makefile.in | 182 +++ lib/ck/doc/ck_array_buffer | 60 + lib/ck/doc/ck_array_commit | 58 + lib/ck/doc/ck_array_deinit | 62 + lib/ck/doc/ck_array_init | 69 + lib/ck/doc/ck_array_initialized | 62 + lib/ck/doc/ck_array_length | 57 + lib/ck/doc/ck_array_put | 65 + lib/ck/doc/ck_array_put_unique | 67 + lib/ck/doc/ck_array_remove | 64 + lib/ck/doc/ck_bitmap_base | 58 + lib/ck/doc/ck_bitmap_bits | 56 + lib/ck/doc/ck_bitmap_buffer | 65 + lib/ck/doc/ck_bitmap_clear | 56 + lib/ck/doc/ck_bitmap_init | 84 ++ lib/ck/doc/ck_bitmap_iterator_init | 70 + lib/ck/doc/ck_bitmap_next | 90 ++ lib/ck/doc/ck_bitmap_reset | 57 + lib/ck/doc/ck_bitmap_set | 57 + lib/ck/doc/ck_bitmap_size | 62 + lib/ck/doc/ck_bitmap_test | 62 + lib/ck/doc/ck_bitmap_union | 58 + lib/ck/doc/ck_brlock | 121 ++ lib/ck/doc/ck_cohort | 211 +++ lib/ck/doc/ck_elide | 252 ++++ lib/ck/doc/ck_epoch_barrier | 120 ++ lib/ck/doc/ck_epoch_begin | 71 + lib/ck/doc/ck_epoch_call | 136 ++ lib/ck/doc/ck_epoch_end | 65 + lib/ck/doc/ck_epoch_init | 69 + lib/ck/doc/ck_epoch_poll | 73 + lib/ck/doc/ck_epoch_reclaim | 92 ++ lib/ck/doc/ck_epoch_recycle | 102 ++ lib/ck/doc/ck_epoch_register | 67 + lib/ck/doc/ck_epoch_synchronize | 123 ++ lib/ck/doc/ck_epoch_unregister | 73 + lib/ck/doc/ck_hs_count | 70 + lib/ck/doc/ck_hs_destroy | 77 + lib/ck/doc/ck_hs_fas | 98 ++ lib/ck/doc/ck_hs_gc | 88 ++ lib/ck/doc/ck_hs_get | 88 ++ lib/ck/doc/ck_hs_grow | 81 ++ lib/ck/doc/ck_hs_init | 169 +++ lib/ck/doc/ck_hs_iterator_init | 78 + lib/ck/doc/ck_hs_move | 90 ++ lib/ck/doc/ck_hs_next | 92 ++ lib/ck/doc/ck_hs_put | 98 ++ lib/ck/doc/ck_hs_put_unique | 98 ++ lib/ck/doc/ck_hs_rebuild | 76 + lib/ck/doc/ck_hs_remove | 92 ++ lib/ck/doc/ck_hs_reset | 77 + lib/ck/doc/ck_hs_reset_size | 80 ++ lib/ck/doc/ck_hs_set | 102 ++ lib/ck/doc/ck_hs_stat | 81 ++ lib/ck/doc/ck_ht_count | 77 + lib/ck/doc/ck_ht_destroy | 87 ++ lib/ck/doc/ck_ht_entry_empty | 90 ++ lib/ck/doc/ck_ht_entry_key | 88 ++ lib/ck/doc/ck_ht_entry_key_direct | 91 ++ lib/ck/doc/ck_ht_entry_key_length | 88 ++ lib/ck/doc/ck_ht_entry_key_set | 93 ++ lib/ck/doc/ck_ht_entry_key_set_direct | 88 ++ lib/ck/doc/ck_ht_entry_set | 95 ++ lib/ck/doc/ck_ht_entry_set_direct | 94 ++ lib/ck/doc/ck_ht_entry_value | 88 ++ lib/ck/doc/ck_ht_entry_value_direct | 89 ++ lib/ck/doc/ck_ht_gc | 96 ++ lib/ck/doc/ck_ht_get_spmc | 177 +++ lib/ck/doc/ck_ht_grow_spmc | 98 ++ lib/ck/doc/ck_ht_hash | 90 ++ lib/ck/doc/ck_ht_hash_direct | 90 ++ lib/ck/doc/ck_ht_init | 188 +++ lib/ck/doc/ck_ht_iterator_init | 88 ++ lib/ck/doc/ck_ht_next | 107 ++ lib/ck/doc/ck_ht_put_spmc | 146 ++ lib/ck/doc/ck_ht_remove_spmc | 117 ++ lib/ck/doc/ck_ht_reset_size_spmc | 84 ++ lib/ck/doc/ck_ht_reset_spmc | 81 ++ lib/ck/doc/ck_ht_set_spmc | 140 ++ lib/ck/doc/ck_ht_stat | 85 ++ lib/ck/doc/ck_pflock | 95 ++ lib/ck/doc/ck_pr | 71 + lib/ck/doc/ck_pr_add | 93 ++ lib/ck/doc/ck_pr_and | 93 ++ lib/ck/doc/ck_pr_barrier | 66 + lib/ck/doc/ck_pr_btc | 90 ++ lib/ck/doc/ck_pr_btr | 90 ++ lib/ck/doc/ck_pr_bts | 90 ++ lib/ck/doc/ck_pr_cas | 147 ++ lib/ck/doc/ck_pr_dec | 124 ++ lib/ck/doc/ck_pr_faa | 99 ++ lib/ck/doc/ck_pr_fas | 100 ++ lib/ck/doc/ck_pr_fence_acquire | 72 + lib/ck/doc/ck_pr_fence_atomic | 111 ++ lib/ck/doc/ck_pr_fence_atomic_load | 108 ++ lib/ck/doc/ck_pr_fence_atomic_store | 109 ++ lib/ck/doc/ck_pr_fence_load | 113 ++ lib/ck/doc/ck_pr_fence_load_atomic | 113 ++ lib/ck/doc/ck_pr_fence_load_depends | 75 + lib/ck/doc/ck_pr_fence_load_store | 113 ++ lib/ck/doc/ck_pr_fence_memory | 113 ++ lib/ck/doc/ck_pr_fence_release | 71 + lib/ck/doc/ck_pr_fence_store | 112 ++ lib/ck/doc/ck_pr_fence_store_atomic | 108 ++ lib/ck/doc/ck_pr_fence_store_load | 107 ++ lib/ck/doc/ck_pr_inc | 124 ++ lib/ck/doc/ck_pr_load | 96 ++ lib/ck/doc/ck_pr_neg | 122 ++ lib/ck/doc/ck_pr_not | 92 ++ lib/ck/doc/ck_pr_or | 93 ++ lib/ck/doc/ck_pr_rtm | 112 ++ lib/ck/doc/ck_pr_stall | 86 ++ lib/ck/doc/ck_pr_store | 96 ++ lib/ck/doc/ck_pr_sub | 93 ++ lib/ck/doc/ck_pr_xor | 93 ++ lib/ck/doc/ck_queue | 147 ++ lib/ck/doc/ck_ring_capacity | 55 + lib/ck/doc/ck_ring_dequeue_spmc | 117 ++ lib/ck/doc/ck_ring_dequeue_spsc | 115 ++ lib/ck/doc/ck_ring_enqueue_spmc | 115 ++ lib/ck/doc/ck_ring_enqueue_spmc_size | 127 ++ lib/ck/doc/ck_ring_enqueue_spsc | 113 ++ lib/ck/doc/ck_ring_enqueue_spsc_size | 128 ++ lib/ck/doc/ck_ring_init | 62 + lib/ck/doc/ck_ring_size | 55 + lib/ck/doc/ck_ring_trydequeue_spmc | 126 ++ lib/ck/doc/ck_rwcohort | 203 +++ lib/ck/doc/ck_rwlock | 143 ++ lib/ck/doc/ck_sequence | 144 ++ lib/ck/doc/ck_spinlock | 259 ++++ lib/ck/doc/ck_swlock | 138 ++ lib/ck/doc/ck_tflock | 95 ++ lib/ck/include/ck_array.h | 101 ++ lib/ck/include/ck_backoff.h | 58 + lib/ck/include/ck_barrier.h | 165 +++ lib/ck/include/ck_bitmap.h | 491 +++++++ lib/ck/include/ck_brlock.h | 280 ++++ lib/ck/include/ck_bytelock.h | 187 +++ lib/ck/include/ck_cc.h | 155 ++ lib/ck/include/ck_cohort.h | 162 +++ lib/ck/include/ck_elide.h | 322 +++++ lib/ck/include/ck_epoch.h | 163 +++ lib/ck/include/ck_fifo.h | 475 +++++++ lib/ck/include/ck_hp.h | 107 ++ lib/ck/include/ck_hp_fifo.h | 222 +++ lib/ck/include/ck_hp_stack.h | 114 ++ lib/ck/include/ck_hs.h | 133 ++ lib/ck/include/ck_ht.h | 262 ++++ lib/ck/include/ck_limits.h | 32 + lib/ck/include/ck_malloc.h | 40 + lib/ck/include/ck_md.h.in | 54 + lib/ck/include/ck_pflock.h | 143 ++ lib/ck/include/ck_pr.h | 1152 +++++++++++++++ lib/ck/include/ck_queue.h | 418 ++++++ lib/ck/include/ck_rhs.h | 130 ++ lib/ck/include/ck_ring.h | 435 ++++++ lib/ck/include/ck_rwcohort.h | 318 +++++ lib/ck/include/ck_rwlock.h | 298 ++++ lib/ck/include/ck_sequence.h | 126 ++ lib/ck/include/ck_spinlock.h | 62 + lib/ck/include/ck_stack.h | 355 +++++ lib/ck/include/ck_stdint.h | 33 + lib/ck/include/ck_swlock.h | 218 +++ lib/ck/include/ck_tflock.h | 133 ++ lib/ck/include/gcc/arm/ck_f_pr.h | 150 ++ lib/ck/include/gcc/arm/ck_pr.h | 516 +++++++ lib/ck/include/gcc/ck_cc.h | 137 ++ lib/ck/include/gcc/ck_f_pr.h | 106 ++ lib/ck/include/gcc/ck_pr.h | 281 ++++ lib/ck/include/gcc/ppc/ck_f_pr.h | 79 ++ lib/ck/include/gcc/ppc/ck_pr.h | 322 +++++ lib/ck/include/gcc/ppc64/ck_f_pr.h | 97 ++ lib/ck/include/gcc/ppc64/ck_pr.h | 419 ++++++ lib/ck/include/gcc/sparcv9/ck_f_pr.h | 26 + lib/ck/include/gcc/sparcv9/ck_pr.h | 225 +++ lib/ck/include/gcc/x86/ck_f_pr.h | 152 ++ lib/ck/include/gcc/x86/ck_pr.h | 388 +++++ lib/ck/include/gcc/x86_64/ck_f_pr.h | 202 +++ lib/ck/include/gcc/x86_64/ck_pr.h | 545 +++++++ lib/ck/include/gcc/x86_64/ck_pr_rtm.h | 109 ++ lib/ck/include/spinlock/anderson.h | 165 +++ lib/ck/include/spinlock/cas.h | 121 ++ lib/ck/include/spinlock/clh.h | 117 ++ lib/ck/include/spinlock/dec.h | 143 ++ lib/ck/include/spinlock/fas.h | 118 ++ lib/ck/include/spinlock/hclh.h | 145 ++ lib/ck/include/spinlock/mcs.h | 149 ++ lib/ck/include/spinlock/ticket.h | 298 ++++ lib/ck/regressions/Makefile | 128 ++ lib/ck/regressions/Makefile.unsupported | 9 + lib/ck/regressions/ck_array/validate/Makefile | 17 + lib/ck/regressions/ck_array/validate/serial.c | 178 +++ lib/ck/regressions/ck_backoff/validate/Makefile | 15 + .../regressions/ck_backoff/validate/validate.c | 60 + .../regressions/ck_barrier/benchmark/Makefile | 14 + .../ck_barrier/benchmark/throughput.c | 136 ++ lib/ck/regressions/ck_barrier/validate/Makefile | 34 + .../ck_barrier/validate/barrier_centralized.c | 121 ++ .../ck_barrier/validate/barrier_combining.c | 143 ++ .../ck_barrier/validate/barrier_dissemination.c | 144 ++ .../ck_barrier/validate/barrier_mcs.c | 131 ++ .../ck_barrier/validate/barrier_tournament.c | 142 ++ lib/ck/regressions/ck_bitmap/validate/Makefile | 17 + lib/ck/regressions/ck_bitmap/validate/serial.c | 350 +++++ lib/ck/regressions/ck_brlock/benchmark/Makefile | 17 + .../regressions/ck_brlock/benchmark/latency.c | 103 ++ .../ck_brlock/benchmark/throughput.c | 164 +++ lib/ck/regressions/ck_brlock/validate/Makefile | 17 + .../regressions/ck_brlock/validate/validate.c | 155 ++ .../regressions/ck_bytelock/benchmark/Makefile | 14 + .../regressions/ck_bytelock/benchmark/latency.c | 99 ++ .../regressions/ck_bytelock/validate/Makefile | 17 + .../regressions/ck_bytelock/validate/validate.c | 166 +++ lib/ck/regressions/ck_cohort/benchmark/Makefile | 17 + .../regressions/ck_cohort/benchmark/ck_cohort.c | 8 + .../ck_cohort/benchmark/throughput.c | 239 ++++ lib/ck/regressions/ck_cohort/ck_cohort.h | 35 + lib/ck/regressions/ck_cohort/validate/Makefile | 17 + .../regressions/ck_cohort/validate/validate.c | 204 +++ lib/ck/regressions/ck_epoch/validate/Makefile | 26 + .../ck_epoch/validate/ck_epoch_poll.c | 245 ++++ .../ck_epoch/validate/ck_epoch_synchronize.c | 258 ++++ lib/ck/regressions/ck_epoch/validate/ck_stack.c | 164 +++ lib/ck/regressions/ck_fifo/benchmark/Makefile | 14 + lib/ck/regressions/ck_fifo/benchmark/latency.c | 157 ++ lib/ck/regressions/ck_fifo/validate/Makefile | 29 + .../regressions/ck_fifo/validate/ck_fifo_mpmc.c | 168 +++ .../ck_fifo/validate/ck_fifo_mpmc_iterator.c | 90 ++ .../regressions/ck_fifo/validate/ck_fifo_spsc.c | 177 +++ .../ck_fifo/validate/ck_fifo_spsc_iterator.c | 83 ++ lib/ck/regressions/ck_hp/benchmark/Makefile | 17 + .../regressions/ck_hp/benchmark/fifo_latency.c | 94 ++ .../regressions/ck_hp/benchmark/stack_latency.c | 95 ++ lib/ck/regressions/ck_hp/validate/Makefile | 33 + lib/ck/regressions/ck_hp/validate/ck_hp_fifo.c | 187 +++ .../ck_hp/validate/ck_hp_fifo_donner.c | 213 +++ lib/ck/regressions/ck_hp/validate/ck_hp_stack.c | 165 +++ .../regressions/ck_hp/validate/nbds_haz_test.c | 224 +++ lib/ck/regressions/ck_hp/validate/serial.c | 127 ++ lib/ck/regressions/ck_hs/benchmark/Makefile | 20 + .../ck_hs/benchmark/parallel_bytestring.c | 602 ++++++++ lib/ck/regressions/ck_hs/benchmark/serial.c | 517 +++++++ lib/ck/regressions/ck_hs/validate/Makefile | 17 + lib/ck/regressions/ck_hs/validate/serial.c | 253 ++++ lib/ck/regressions/ck_ht/benchmark/Makefile | 27 + .../ck_ht/benchmark/parallel_bytestring.c | 565 ++++++++ .../ck_ht/benchmark/parallel_direct.c | 552 ++++++++ lib/ck/regressions/ck_ht/benchmark/serial.c | 398 ++++++ lib/ck/regressions/ck_ht/validate/Makefile | 21 + lib/ck/regressions/ck_ht/validate/serial.c | 292 ++++ lib/ck/regressions/ck_pflock/benchmark/Makefile | 17 + .../regressions/ck_pflock/benchmark/latency.c | 72 + .../ck_pflock/benchmark/throughput.c | 163 +++ lib/ck/regressions/ck_pflock/validate/Makefile | 17 + .../regressions/ck_pflock/validate/validate.c | 151 ++ lib/ck/regressions/ck_pr/benchmark/Makefile | 18 + lib/ck/regressions/ck_pr/benchmark/benchmark.h | 130 ++ .../regressions/ck_pr/benchmark/ck_pr_cas_64.c | 16 + .../ck_pr/benchmark/ck_pr_cas_64_2.c | 17 + .../regressions/ck_pr/benchmark/ck_pr_fas_64.c | 17 + lib/ck/regressions/ck_pr/validate/Makefile | 84 ++ lib/ck/regressions/ck_pr/validate/ck_pr_add.c | 151 ++ lib/ck/regressions/ck_pr/validate/ck_pr_and.c | 147 ++ lib/ck/regressions/ck_pr/validate/ck_pr_bin.c | 94 ++ lib/ck/regressions/ck_pr/validate/ck_pr_btc.c | 96 ++ lib/ck/regressions/ck_pr/validate/ck_pr_btr.c | 97 ++ lib/ck/regressions/ck_pr/validate/ck_pr_bts.c | 97 ++ lib/ck/regressions/ck_pr/validate/ck_pr_btx.c | 112 ++ lib/ck/regressions/ck_pr/validate/ck_pr_cas.c | 158 +++ lib/ck/regressions/ck_pr/validate/ck_pr_dec.c | 143 ++ lib/ck/regressions/ck_pr/validate/ck_pr_faa.c | 152 ++ lib/ck/regressions/ck_pr/validate/ck_pr_fas.c | 148 ++ lib/ck/regressions/ck_pr/validate/ck_pr_fax.c | 121 ++ lib/ck/regressions/ck_pr/validate/ck_pr_inc.c | 143 ++ lib/ck/regressions/ck_pr/validate/ck_pr_load.c | 149 ++ lib/ck/regressions/ck_pr/validate/ck_pr_n.c | 90 ++ lib/ck/regressions/ck_pr/validate/ck_pr_or.c | 149 ++ lib/ck/regressions/ck_pr/validate/ck_pr_store.c | 150 ++ lib/ck/regressions/ck_pr/validate/ck_pr_sub.c | 151 ++ lib/ck/regressions/ck_pr/validate/ck_pr_unary.c | 117 ++ lib/ck/regressions/ck_pr/validate/ck_pr_xor.c | 147 ++ lib/ck/regressions/ck_queue/validate/Makefile | 26 + lib/ck/regressions/ck_queue/validate/ck_list.c | 236 ++++ lib/ck/regressions/ck_queue/validate/ck_slist.c | 217 +++ .../regressions/ck_queue/validate/ck_stailq.c | 256 ++++ lib/ck/regressions/ck_rhs/benchmark/Makefile | 17 + .../ck_rhs/benchmark/parallel_bytestring.c | 599 ++++++++ lib/ck/regressions/ck_rhs/benchmark/serial.c | 517 +++++++ lib/ck/regressions/ck_rhs/validate/Makefile | 17 + lib/ck/regressions/ck_rhs/validate/serial.c | 245 ++++ lib/ck/regressions/ck_ring/benchmark/Makefile | 14 + lib/ck/regressions/ck_ring/benchmark/latency.c | 93 ++ lib/ck/regressions/ck_ring/validate/Makefile | 29 + .../regressions/ck_ring/validate/ck_ring_spmc.c | 340 +++++ .../ck_ring/validate/ck_ring_spmc_template.c | 347 +++++ .../regressions/ck_ring/validate/ck_ring_spsc.c | 213 +++ .../regressions/ck_rwcohort/benchmark/Makefile | 32 + .../ck_rwcohort/benchmark/ck_neutral.c | 7 + .../regressions/ck_rwcohort/benchmark/ck_rp.c | 7 + .../regressions/ck_rwcohort/benchmark/ck_wp.c | 7 + .../regressions/ck_rwcohort/benchmark/latency.h | 106 ++ .../ck_rwcohort/benchmark/throughput.h | 245 ++++ lib/ck/regressions/ck_rwcohort/ck_neutral.h | 8 + lib/ck/regressions/ck_rwcohort/ck_rp.h | 8 + lib/ck/regressions/ck_rwcohort/ck_wp.h | 8 + .../regressions/ck_rwcohort/validate/Makefile | 25 + .../ck_rwcohort/validate/ck_neutral.c | 2 + lib/ck/regressions/ck_rwcohort/validate/ck_rp.c | 2 + lib/ck/regressions/ck_rwcohort/validate/ck_wp.c | 2 + .../regressions/ck_rwcohort/validate/validate.h | 209 +++ lib/ck/regressions/ck_rwlock/benchmark/Makefile | 17 + .../regressions/ck_rwlock/benchmark/latency.c | 134 ++ .../ck_rwlock/benchmark/throughput.c | 254 ++++ lib/ck/regressions/ck_rwlock/validate/Makefile | 17 + .../regressions/ck_rwlock/validate/validate.c | 447 ++++++ .../regressions/ck_sequence/benchmark/Makefile | 18 + .../ck_sequence/benchmark/ck_sequence.c | 91 ++ .../regressions/ck_sequence/validate/Makefile | 17 + .../ck_sequence/validate/ck_sequence.c | 168 +++ .../regressions/ck_spinlock/benchmark/Makefile | 87 ++ .../ck_spinlock/benchmark/ck_anderson.c | 8 + .../regressions/ck_spinlock/benchmark/ck_cas.c | 8 + .../regressions/ck_spinlock/benchmark/ck_clh.c | 7 + .../regressions/ck_spinlock/benchmark/ck_dec.c | 7 + .../regressions/ck_spinlock/benchmark/ck_fas.c | 7 + .../regressions/ck_spinlock/benchmark/ck_hclh.c | 7 + .../regressions/ck_spinlock/benchmark/ck_mcs.c | 7 + .../ck_spinlock/benchmark/ck_spinlock.c | 7 + .../ck_spinlock/benchmark/ck_ticket.c | 8 + .../ck_spinlock/benchmark/ck_ticket_pb.c | 7 + .../regressions/ck_spinlock/benchmark/latency.h | 76 + .../ck_spinlock/benchmark/linux_spinlock.c | 7 + .../ck_spinlock/benchmark/throughput.h | 218 +++ lib/ck/regressions/ck_spinlock/ck_anderson.h | 11 + lib/ck/regressions/ck_spinlock/ck_cas.h | 6 + lib/ck/regressions/ck_spinlock/ck_clh.h | 9 + lib/ck/regressions/ck_spinlock/ck_dec.h | 6 + lib/ck/regressions/ck_spinlock/ck_fas.h | 6 + lib/ck/regressions/ck_spinlock/ck_hclh.h | 16 + lib/ck/regressions/ck_spinlock/ck_mcs.h | 7 + lib/ck/regressions/ck_spinlock/ck_spinlock.h | 6 + lib/ck/regressions/ck_spinlock/ck_ticket.h | 11 + lib/ck/regressions/ck_spinlock/ck_ticket_pb.h | 6 + lib/ck/regressions/ck_spinlock/linux_spinlock.h | 39 + .../regressions/ck_spinlock/validate/Makefile | 56 + .../ck_spinlock/validate/ck_anderson.c | 2 + .../regressions/ck_spinlock/validate/ck_cas.c | 2 + .../regressions/ck_spinlock/validate/ck_clh.c | 2 + .../regressions/ck_spinlock/validate/ck_dec.c | 2 + .../regressions/ck_spinlock/validate/ck_fas.c | 2 + .../regressions/ck_spinlock/validate/ck_hclh.c | 2 + .../regressions/ck_spinlock/validate/ck_mcs.c | 2 + .../ck_spinlock/validate/ck_spinlock.c | 2 + .../ck_spinlock/validate/ck_ticket.c | 2 + .../ck_spinlock/validate/ck_ticket_pb.c | 2 + .../ck_spinlock/validate/linux_spinlock.c | 14 + .../regressions/ck_spinlock/validate/validate.h | 181 +++ lib/ck/regressions/ck_stack/benchmark/Makefile | 14 + lib/ck/regressions/ck_stack/benchmark/latency.c | 176 +++ lib/ck/regressions/ck_stack/validate/Makefile | 56 + lib/ck/regressions/ck_stack/validate/pair.c | 249 ++++ lib/ck/regressions/ck_stack/validate/pop.c | 269 ++++ lib/ck/regressions/ck_stack/validate/push.c | 248 ++++ lib/ck/regressions/ck_stack/validate/serial.c | 84 ++ lib/ck/regressions/ck_swlock/benchmark/Makefile | 17 + .../regressions/ck_swlock/benchmark/latency.c | 86 ++ .../ck_swlock/benchmark/throughput.c | 183 +++ lib/ck/regressions/ck_swlock/validate/Makefile | 17 + .../regressions/ck_swlock/validate/validate.c | 455 ++++++ lib/ck/regressions/ck_tflock/benchmark/Makefile | 17 + .../regressions/ck_tflock/benchmark/latency.c | 73 + .../ck_tflock/benchmark/throughput.c | 182 +++ lib/ck/regressions/ck_tflock/validate/Makefile | 17 + .../regressions/ck_tflock/validate/validate.c | 158 +++ lib/ck/regressions/common.h | 457 ++++++ lib/ck/src/Makefile.in | 62 + lib/ck/src/ck_array.c | 241 ++++ lib/ck/src/ck_barrier_centralized.c | 60 + lib/ck/src/ck_barrier_combining.c | 208 +++ lib/ck/src/ck_barrier_dissemination.c | 124 ++ lib/ck/src/ck_barrier_mcs.c | 141 ++ lib/ck/src/ck_barrier_tournament.c | 184 +++ lib/ck/src/ck_epoch.c | 429 ++++++ lib/ck/src/ck_hp.c | 324 +++++ lib/ck/src/ck_hs.c | 845 +++++++++++ lib/ck/src/ck_ht.c | 1030 ++++++++++++++ lib/ck/src/ck_ht_hash.h | 269 ++++ lib/ck/src/ck_internal.h | 119 ++ lib/ck/src/ck_rhs.c | 1335 ++++++++++++++++++ lib/ck/tools/feature.sh | 5 + 422 files changed, 53672 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/.gitignore ---------------------------------------------------------------------- diff --git a/lib/ck/.gitignore b/lib/ck/.gitignore new file mode 100644 index 0000000..2c6cb8b --- /dev/null +++ b/lib/ck/.gitignore @@ -0,0 +1,178 @@ +/Makefile +build/ck.build +build/ck.pc +build/regressions.build +build/ck.spec +include/ck_md.h +src/Makefile +doc/Makefile +build/Makefile +.DS_Store +*.html +*.gz +*.o +*.a +*.so +*.dSYM +.*.sw[op] +GPATH +GRTAGS +GTAGS +ID +regressions/ck_array/validate/serial +regressions/ck_backoff/validate/validate +regressions/ck_bag/validate/order +regressions/ck_barrier/benchmark/throughput +regressions/ck_barrier/validate/barrier_centralized +regressions/ck_barrier/validate/barrier_combining +regressions/ck_barrier/validate/barrier_dissemination +regressions/ck_barrier/validate/barrier_mcs +regressions/ck_barrier/validate/barrier_tournament +regressions/ck_bitmap/validate/serial +regressions/ck_brlock/benchmark/latency +regressions/ck_brlock/benchmark/throughput +regressions/ck_brlock/validate/validate +regressions/ck_bytelock/benchmark/latency +regressions/ck_bytelock/validate/validate +regressions/ck_cohort/benchmark/ck_cohort.LATENCY +regressions/ck_cohort/benchmark/ck_cohort.LATENCY +regressions/ck_cohort/benchmark/ck_cohort.THROUGHPUT +regressions/ck_cohort/benchmark/ck_cohort.THROUGHPUT +regressions/ck_cohort/validate/validate +regressions/ck_epoch/validate/ck_epoch_poll +regressions/ck_epoch/validate/ck_epoch_synchronize +regressions/ck_epoch/validate/ck_stack +regressions/ck_epoch/validate/ck_stack_read +regressions/ck_fifo/benchmark/latency +regressions/ck_fifo/validate/ck_fifo_mpmc +regressions/ck_fifo/validate/ck_fifo_mpmc_iterator +regressions/ck_fifo/validate/ck_fifo_spsc +regressions/ck_fifo/validate/ck_fifo_spsc_iterator +regressions/ck_hp/benchmark/fifo_latency +regressions/ck_hp/benchmark/stack_latency +regressions/ck_hp/validate/ck_hp_fifo +regressions/ck_hp/validate/ck_hp_fifo_donner +regressions/ck_hp/validate/ck_hp_stack +regressions/ck_hp/validate/nbds_haz_test +regressions/ck_hp/validate/serial +regressions/ck_hs/benchmark/parallel_bytestring +regressions/ck_hs/benchmark/parallel_bytestring.delete +regressions/ck_hs/benchmark/serial +regressions/ck_hs/validate/serial +regressions/ck_ht/benchmark/parallel_bytestring +regressions/ck_ht/benchmark/parallel_bytestring.delete +regressions/ck_ht/benchmark/parallel_direct +regressions/ck_ht/benchmark/serial +regressions/ck_ht/benchmark/serial.delete +regressions/ck_ht/validate/serial +regressions/ck_ht/validate/serial.delete +regressions/ck_pflock/benchmark/latency +regressions/ck_pflock/benchmark/throughput +regressions/ck_pflock/validate/validate +regressions/ck_pr/benchmark/ck_pr_cas_64 +regressions/ck_pr/benchmark/ck_pr_cas_64_2 +regressions/ck_pr/benchmark/ck_pr_fas_64 +regressions/ck_pr/validate/ck_pr_add +regressions/ck_pr/validate/ck_pr_and +regressions/ck_pr/validate/ck_pr_bin +regressions/ck_pr/validate/ck_pr_btc +regressions/ck_pr/validate/ck_pr_btr +regressions/ck_pr/validate/ck_pr_bts +regressions/ck_pr/validate/ck_pr_btx +regressions/ck_pr/validate/ck_pr_cas +regressions/ck_pr/validate/ck_pr_dec +regressions/ck_pr/validate/ck_pr_faa +regressions/ck_pr/validate/ck_pr_fas +regressions/ck_pr/validate/ck_pr_fax +regressions/ck_pr/validate/ck_pr_inc +regressions/ck_pr/validate/ck_pr_load +regressions/ck_pr/validate/ck_pr_n +regressions/ck_pr/validate/ck_pr_or +regressions/ck_pr/validate/ck_pr_store +regressions/ck_pr/validate/ck_pr_sub +regressions/ck_pr/validate/ck_pr_unary +regressions/ck_pr/validate/ck_pr_xor +regressions/ck_queue/validate/ck_list +regressions/ck_queue/validate/ck_slist +regressions/ck_queue/validate/ck_stailq +regressions/ck_rhs/benchmark/parallel_bytestring +regressions/ck_rhs/benchmark/serial +regressions/ck_rhs/validate/serial +regressions/ck_ring/benchmark/latency +regressions/ck_ring/validate/ck_ring_spmc +regressions/ck_ring/validate/ck_ring_spmc_template +regressions/ck_ring/validate/ck_ring_spsc +regressions/ck_ring/validate/ck_ring_spsc_template +regressions/ck_rwcohort/benchmark/ck_neutral.LATENCY +regressions/ck_rwcohort/benchmark/ck_neutral.THROUGHPUT +regressions/ck_rwcohort/benchmark/ck_rp.LATENCY +regressions/ck_rwcohort/benchmark/ck_rp.THROUGHPUT +regressions/ck_rwcohort/benchmark/ck_wp.LATENCY +regressions/ck_rwcohort/benchmark/ck_wp.THROUGHPUT +regressions/ck_rwcohort/validate/ck_neutral +regressions/ck_rwcohort/validate/ck_rp +regressions/ck_rwcohort/validate/ck_wp +regressions/ck_rwlock/benchmark/latency +regressions/ck_rwlock/benchmark/throughput +regressions/ck_rwlock/validate/validate +regressions/ck_sequence/benchmark/ck_sequence +regressions/ck_sequence/validate/ck_sequence +regressions/ck_spinlock/benchmark/ck_anderson.LATENCY +regressions/ck_spinlock/benchmark/ck_anderson.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_cas.LATENCY +regressions/ck_spinlock/benchmark/ck_cas.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_clh.LATENCY +regressions/ck_spinlock/benchmark/ck_clh.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_dec.LATENCY +regressions/ck_spinlock/benchmark/ck_dec.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_fas.LATENCY +regressions/ck_spinlock/benchmark/ck_fas.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_hclh.LATENCY +regressions/ck_spinlock/benchmark/ck_hclh.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_mcs.LATENCY +regressions/ck_spinlock/benchmark/ck_mcs.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_spinlock.LATENCY +regressions/ck_spinlock/benchmark/ck_spinlock.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_ticket.LATENCY +regressions/ck_spinlock/benchmark/ck_ticket.THROUGHPUT +regressions/ck_spinlock/benchmark/ck_ticket_pb.LATENCY +regressions/ck_spinlock/benchmark/ck_ticket_pb.THROUGHPUT +regressions/ck_spinlock/benchmark/linux_spinlock.LATENCY +regressions/ck_spinlock/benchmark/linux_spinlock.THROUGHPUT +regressions/ck_spinlock/validate/ck_anderson +regressions/ck_spinlock/validate/ck_cas +regressions/ck_spinlock/validate/ck_clh +regressions/ck_spinlock/validate/ck_dec +regressions/ck_spinlock/validate/ck_fas +regressions/ck_spinlock/validate/ck_hclh +regressions/ck_spinlock/validate/ck_mcs +regressions/ck_spinlock/validate/ck_spinlock +regressions/ck_spinlock/validate/ck_ticket +regressions/ck_spinlock/validate/ck_ticket_pb +regressions/ck_spinlock/validate/linux_spinlock +regressions/ck_stack/benchmark/latency +regressions/ck_stack/validate/mpmc_pair +regressions/ck_stack/validate/mpmc_pop +regressions/ck_stack/validate/mpmc_push +regressions/ck_stack/validate/mpmc_trypair +regressions/ck_stack/validate/mpmc_trypop +regressions/ck_stack/validate/mpmc_trypush +regressions/ck_stack/validate/mpnc_push +regressions/ck_stack/validate/pthreads_pair +regressions/ck_stack/validate/serial +regressions/ck_stack/validate/spinlock_eb_pair +regressions/ck_stack/validate/spinlock_eb_pop +regressions/ck_stack/validate/spinlock_eb_push +regressions/ck_stack/validate/spinlock_pair +regressions/ck_stack/validate/spinlock_pop +regressions/ck_stack/validate/spinlock_push +regressions/ck_stack/validate/upmc_pop +regressions/ck_stack/validate/upmc_push +regressions/ck_stack/validate/upmc_trypop +regressions/ck_stack/validate/upmc_trypush +regressions/ck_swlock/benchmark/latency +regressions/ck_swlock/benchmark/throughput +regressions/ck_swlock/validate/validate +regressions/ck_tflock/benchmark/latency +regressions/ck_tflock/benchmark/throughput +regressions/ck_tflock/validate/validate http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/LICENSE ---------------------------------------------------------------------- diff --git a/lib/ck/LICENSE b/lib/ck/LICENSE new file mode 100644 index 0000000..73b0eeb --- /dev/null +++ b/lib/ck/LICENSE @@ -0,0 +1,54 @@ +Copyright 2010-2014 Samy Al Bahra. +Copyright 2011-2013 AppNexus, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Hazard Pointers (src/ck_hp.c) also includes this license: + +(c) Copyright 2008, IBM Corporation. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +ck_pr_rtm leverages work from Andi Kleen: +Copyright (c) 2012,2013 Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that: (1) source code distributions +retain the above copyright notice and this paragraph in its entirety, (2) +distributions including binary code include the above copyright notice and +this paragraph in its entirety in the documentation or other materials +provided with the distribution + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/Makefile.in ---------------------------------------------------------------------- diff --git a/lib/ck/Makefile.in b/lib/ck/Makefile.in new file mode 100644 index 0000000..7e73f70 --- /dev/null +++ b/lib/ck/Makefile.in @@ -0,0 +1,103 @@ +.PHONY: all check clean dist distclean doc install install-headers regressions uninstall + +BUILD_DIR=@BUILD_DIR@ +SRC_DIR=@SRC_DIR@ +CFLAGS=@CFLAGS@ +VERSION=@VERSION@ +VERSION_MAJOR=@VERSION_MAJOR@ +PREFIX=@PREFIX@ +LIBRARY=@LIBRARY@ +HEADERS=@HEADERS@ +PKGCONFIG_DATA=@LIBRARY@/pkgconfig +LDNAME=@LDNAME@ +LDNAME_VERSION=@LDNAME_VERSION@ +LDNAME_MAJOR=@LDNAME_MAJOR@ + +all: doc + $(MAKE) -C src all || exit + @echo + @echo + @echo ---[ Concurrency Kit has built successfully. You may now \"make install\". + +doc: + $(MAKE) -C doc all || exit + @echo ---[ Manual pages are ready for installation. + +regressions: + $(MAKE) -C regressions all || exit + @echo ---[ Regressions have built successfully. + +check: regressions + @echo ---[ Executing unit tests... + $(MAKE) -C regressions check + @echo ---[ Unit tests have completed successfully. + +install-headers: + mkdir -p $(DESTDIR)/$(HEADERS) || exit + cp $(SRC_DIR)/include/*.h $(DESTDIR)/$(HEADERS) || exit + chmod 644 $(DESTDIR)/$(HEADERS)/ck_*.h || exit + mkdir -p $(DESTDIR)$(HEADERS)/gcc || exit + cp -r $(SRC_DIR)/include/gcc/* $(DESTDIR)/$(HEADERS)/gcc || exit + cp include/ck_md.h $(DESTDIR)/$(HEADERS)/ck_md.h || exit + chmod 755 $(DESTDIR)/$(HEADERS)/gcc + chmod 644 $(DESTDIR)/$(HEADERS)/gcc/ck_*.h $(DESTDIR)/$(HEADERS)/gcc/*/ck_*.h || exit + mkdir -p $(DESTDIR)$(HEADERS)/spinlock || exit + cp -r $(SRC_DIR)/include/spinlock/* $(DESTDIR)/$(HEADERS)/spinlock || exit + chmod 755 $(DESTDIR)/$(HEADERS)/spinlock + chmod 644 $(DESTDIR)/$(HEADERS)/spinlock/*.h || exit + +install-so: + mkdir -p $(DESTDIR)/$(LIBRARY) + cp src/libck.so $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) + ln -sf $(LDNAME_VERSION) $(DESTDIR)/$(LIBRARY)/$(LDNAME) + ln -sf $(LDNAME_VERSION) $(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR) + chmod 744 $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) \ + $(DESTDIR)/$(LIBRARY)/$(LDNAME) \ + $(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR) + +install-lib: + mkdir -p $(DESTDIR)/$(LIBRARY) + cp src/libck.a $(DESTDIR)/$(LIBRARY)/libck.a + chmod 644 $(DESTDIR)/$(LIBRARY)/libck.a + +install: all install-headers @INSTALL_LIBS@ + $(MAKE) -C doc install + mkdir -p $(DESTDIR)/$(LIBRARY) || exit + mkdir -p $(DESTDIR)/$(PKGCONFIG_DATA) || exit + chmod 755 $(DESTDIR)/$(PKGCONFIG_DATA) + cp build/ck.pc $(DESTDIR)/$(PKGCONFIG_DATA)/ck.pc || exit + @echo + @echo + @echo ---[ Concurrency Kit has installed successfully. + +uninstall: + $(MAKE) -C doc uninstall + rm -f $(DESTDIR)/$(LIBRARY)/$(LDNAME_VERSION) \ + $(DESTDIR)/$(LIBRARY)/$(LDNAME) \ + $(DESTDIR)/$(LIBRARY)/$(LDNAME_MAJOR) + rm -f $(DESTDIR)/$(LIBRARY)/libck.so* + rm -f $(DESTDIR)/$(LIBRARY)/libck.a + rm -f $(DESTDIR)/$(HEADERS)/ck_*.h + rm -f $(DESTDIR)/$(HEADERS)/spinlock/*.h + rm -f $(DESTDIR)/$(HEADERS)/gcc/ck_*.h + rm -f $(DESTDIR)/$(HEADERS)/gcc/*/ck_*.h + rm -f $(DESTDIR)/$(PKGCONFIG_DATA)/ck.pc + +clean: + $(MAKE) -C doc clean + $(MAKE) -C src clean + $(MAKE) -C regressions clean + rm -f $(BUILD_DIR)/*~ $(BUILD_DIR)/*.o $(BUILD_DIR)/*.tar.gz + +dist: + git archive --remote=$(SRC_DIR) --format=tar --prefix=ck-$(VERSION)/ HEAD \ + | gzip > $(BUILD_DIR)/ck-$(VERSION).tar.gz + +distclean: clean + rm -f $(BUILD_DIR)/include/ck_md.h + rm -f $(BUILD_DIR)/build/regressions.build + rm -f $(BUILD_DIR)/build/ck.build + rm -f $(BUILD_DIR)/build/ck.pc + rm -f $(BUILD_DIR)/Makefile + rm -f $(BUILD_DIR)/doc/Makefile + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/README ---------------------------------------------------------------------- diff --git a/lib/ck/README b/lib/ck/README new file mode 100644 index 0000000..81fb5ac --- /dev/null +++ b/lib/ck/README @@ -0,0 +1,21 @@ + ____ _ ___ _ + / ___|___ _ __ ___ _ _ _ __ _ __ ___ _ __ ___ _ _ | |/ (_) |_ +| | / _ \| '_ \ / __| | | | '__| '__/ _ \ '_ \ / __| | | | | ' /| | __| +| |__| (_) | | | | (__| |_| | | | | | __/ | | | (__| |_| | | . \| | |_ + \____\___/|_| |_|\___|\__,_|_| |_| \___|_| |_|\___|\__, | |_|\_\_|\__| + |___/ + +Step 1. + ./configure + For additional options try ./configure --help + +Step 2. + In order to compile regressions (requires POSIX threads) use + "make regressions". In order to compile libck use "make all" or "make". + +Step 3. + In order to install use "make install" + To uninstall use "make uninstall". + +See http://concurrencykit.org/ for more information. + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.aarch64 ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.aarch64 b/lib/ck/build/ck.build.aarch64 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/ck/build/ck.build.aarch64 @@ -0,0 +1 @@ + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.arm ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.arm b/lib/ck/build/ck.build.arm new file mode 100644 index 0000000..3fa739c --- /dev/null +++ b/lib/ck/build/ck.build.arm @@ -0,0 +1 @@ +CFLAGS+=-D__arm__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.in ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.in b/lib/ck/build/ck.build.in new file mode 100644 index 0000000..6bcd044 --- /dev/null +++ b/lib/ck/build/ck.build.in @@ -0,0 +1,10 @@ +CC=@CC@ +MAKE=make +SRC_DIR=@SRC_DIR@ +BUILD_DIR=@BUILD_DIR@ +CFLAGS=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include +LDFLAGS=@LDFLAGS@ +ALL_LIBS=@ALL_LIBS@ +LD=@LD@ + +include $(BUILD_DIR)/build/ck.build.@PROFILE@ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.ppc ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.ppc b/lib/ck/build/ck.build.ppc new file mode 100644 index 0000000..bd0c2fd --- /dev/null +++ b/lib/ck/build/ck.build.ppc @@ -0,0 +1 @@ +CFLAGS+=-m32 -D__ppc__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.ppc64 ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.ppc64 b/lib/ck/build/ck.build.ppc64 new file mode 100644 index 0000000..7dcb4f4 --- /dev/null +++ b/lib/ck/build/ck.build.ppc64 @@ -0,0 +1 @@ +CFLAGS+=-m64 -D__ppc64__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.sparcv9 ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.sparcv9 b/lib/ck/build/ck.build.sparcv9 new file mode 100644 index 0000000..d866841 --- /dev/null +++ b/lib/ck/build/ck.build.sparcv9 @@ -0,0 +1 @@ +CFLAGS+=-m64 -D__sparcv9__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.x86 ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.x86 b/lib/ck/build/ck.build.x86 new file mode 100644 index 0000000..2758c8a --- /dev/null +++ b/lib/ck/build/ck.build.x86 @@ -0,0 +1 @@ +CFLAGS+=-m32 -D__x86__ -msse -msse2 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.build.x86_64 ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.build.x86_64 b/lib/ck/build/ck.build.x86_64 new file mode 100644 index 0000000..54643ef --- /dev/null +++ b/lib/ck/build/ck.build.x86_64 @@ -0,0 +1 @@ +CFLAGS+=-m64 -D__x86_64__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.pc.in ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.pc.in b/lib/ck/build/ck.pc.in new file mode 100644 index 0000000..5f0e97a --- /dev/null +++ b/lib/ck/build/ck.pc.in @@ -0,0 +1,10 @@ +prefix=@PREFIX@ +includedir=@HEADERS@ +libdir=@LIBRARY@ + +Name: Concurrency Kit +Description: Toolkit for well-specified design and implementation of concurrent systems +URL: http://concurrencykit.org/ +Version: @VERSION@ +Libs: -L${libdir} -lck +Cflags: -D__@PROFILE@__ -I${includedir} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/ck.spec.in ---------------------------------------------------------------------- diff --git a/lib/ck/build/ck.spec.in b/lib/ck/build/ck.spec.in new file mode 100644 index 0000000..e486d53 --- /dev/null +++ b/lib/ck/build/ck.spec.in @@ -0,0 +1,74 @@ +Name: ck +Version: @VERSION@ +Release: 1%{?dist} +Group: Development/Libraries +Summary: Concurrency Kit +License: Simplified BSD License +URL: http://concurrencykit.org +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Source: http://concurrencykit.org/releases/ck-%{version}.tar.gz + +%description +Concurrency Kit provides a plethora of concurrency primitives, safe memory +reclamation mechanisms and lock-less and lock-free data structures designed to +aid in the design and implementation of high performance concurrent systems. It +is designed to minimize dependencies on operating system-specific interfaces +and most of the interface relies only on a strict subset of the standard +library and more popular compiler extensions. + +%package devel +Group: Development/Libraries +Summary: Header files and libraries for CK development +Requires: %{name} = %{version}-%{release} + +%description devel +Concurrency Kit provides a plethora of concurrency primitives, safe memory +reclamation mechanisms and lock-less and lock-free data structures designed to +aid in the design and implementation of high performance concurrent systems. It +is designed to minimize dependencies on operating system-specific interfaces +and most of the interface relies only on a strict subset of the standard +library and more popular compiler extensions. + +This package provides the libraries, include files, and other +resources needed for developing Concurrency Kit applications. + +%prep +%setup -q + +%build +CFLAGS=$RPM_OPT_FLAGS ./configure \ + --libdir=%{_libdir} \ + --includedir=%{_includedir}/%{name} \ + --mandir=%{_mandir} \ + --prefix=%{_prefix} +make %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{_libdir}/libck.so.@VERSION@ +%{_libdir}/libck.so.@VERSION_MAJOR@ + +%files devel +%defattr(-,root,root) +%{_libdir}/libck.so +%{_includedir}/%{name}/*.h +%{_includedir}/%{name}/*/*.h +%{_includedir}/%{name}/*/*/*.h +%{_libdir}/libck.a +%{_libdir}/pkgconfig/%{name}.pc +%{_mandir}/man3/*.3.gz + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/build/regressions.build.in ---------------------------------------------------------------------- diff --git a/lib/ck/build/regressions.build.in b/lib/ck/build/regressions.build.in new file mode 100644 index 0000000..6d79a8b --- /dev/null +++ b/lib/ck/build/regressions.build.in @@ -0,0 +1,10 @@ +CC=@CC@ +MAKE=make +CORES=@CORES@ +CFLAGS=@CFLAGS@ -I../../../include -DCORES=@CORES@ +LD=@LD@ +LDFLAGS=@LDFLAGS@ +PTHREAD_CFLAGS=@PTHREAD_CFLAGS@ +BUILD_DIR=@BUILD_DIR@ + +include $(BUILD_DIR)/build/ck.build.@PROFILE@ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/configure ---------------------------------------------------------------------- diff --git a/lib/ck/configure b/lib/ck/configure new file mode 100755 index 0000000..9e24c0e --- /dev/null +++ b/lib/ck/configure @@ -0,0 +1,708 @@ +#!/bin/sh +# +# Copyright © 2009-2013 Samy Al Bahra. +# Copyright © 2011 Devon H. O'Dell <devon.od...@gmail.com> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +REQUIRE_HEADER="stdbool.h stddef.h stdint.h string.h" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +WANT_PIC=yes + +P_PWD=`pwd` +MAINTAINER='sba...@repnop.org' +VERSION=${VERSION:-'0.4.3'} +VERSION_MAJOR='0' +BUILD="$PWD/build/ck.build" +PREFIX=${PREFIX:-"/usr/local"} +LDNAME="libck.so" +LDNAME_VERSION="libck.so.$VERSION" +LDNAME_MAJOR="libck.so.$VERSION_MAJOR" + +export CFLAGS +export PREFIX +LC_ALL=C +export LC_ALL + +if test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +trap epilog 1 2 3 6 + +epilog() +{ + rm -f .1.c .1 +} + +assert() +{ + + if test "$#" -eq 2; then + fail=$2 + print=true + elif test "$#" -eq 3; then + fail=$3 + print=echo + else + echo "Usage: assert <test> <fail string> or assert <test> <success string> <fail string>" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$1"; then + echo "failed [$fail]" + exit $EXIT_FAILURE + else + ${print} "success [$1]" + fi +} + +generate() +{ + sed -e "s#@PROFILE@#$PROFILE#g" \ + -e "s#@VERSION@#$VERSION#g" \ + -e "s#@VERSION_MAJOR@#$VERSION_MAJOR#g" \ + -e "s#@CC@#$CC#g" \ + -e "s#@CFLAGS@#$CFLAGS#g" \ + -e "s#@HEADERS@#$HEADERS#g" \ + -e "s#@LIBRARY@#$LIBRARY#g" \ + -e "s#@PREFIX@#$PREFIX#g" \ + -e "s#@CORES@#$CORES#g" \ + -e "s#@ALL_LIBS@#$ALL_LIBS#g" \ + -e "s#@INSTALL_LIBS@#$INSTALL_LIBS#g" \ + -e "s#@LD@#$LD#g" \ + -e "s#@LDFLAGS@#$LDFLAGS#g" \ + -e "s#@PTHREAD_CFLAGS@#$PTHREAD_CFLAGS#g" \ + -e "s#@MANDIR@#$MANDIR#g" \ + -e "s#@GZIP@#$GZIP#g" \ + -e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \ + -e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \ + -e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \ + -e "s#@VMA_BITS@#$VMA_BITS_R#g" \ + -e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \ + -e "s#@MM@#$MM#g" \ + -e "s#@BUILD_DIR@#$P_PWD#g" \ + -e "s#@SRC_DIR@#$BUILD_DIR#g" \ + -e "s#@LDNAME@#$LDNAME#g" \ + -e "s#@LDNAME_MAJOR@#$LDNAME_MAJOR#g" \ + -e "s#@LDNAME_VERSION@#$LDNAME_VERSION#g" \ + $1 > $2 +} + +generate_stdout() +{ + + echo + echo " VERSION = $VERSION" + echo " BUILD_DIR = $P_PWD" + echo " SRC_DIR = $BUILD_DIR" + echo " SYSTEM = $SYSTEM" + echo " PROFILE = $PROFILE" + echo " CC = $CC" + echo " COMPILER = $COMPILER" + echo " CFLAGS = $CFLAGS" + echo " PTHREAD_CFLAGS = $PTHREAD_CFLAGS" + echo " LD = $LD" + echo " LDNAME = $LDNAME" + echo " LDNAME_VERSION = $LDNAME_VERSION" + echo " LDNAME_MAJOR = $LDNAME_MAJOR" + echo " LDFLAGS = $LDFLAGS" + echo " GZIP = $GZIP" + echo " CORES = $CORES" + echo " POINTER_PACK = $POINTER_PACK_ENABLE" + echo " VMA_BITS = $VMA_BITS" + echo " MEMORY_MODEL = $MM" + echo " RTM = $RTM_ENABLE" + echo + echo "Headers will be installed in $HEADERS" + echo "Libraries will be installed in $LIBRARY" + echo "Documentation will be installed in $MANDIR" +} + +for option in $*; do + value=`echo "$option" | sed -e 's/^[^=]*=\(.*\)/\1/'` + + case "$option" in + --help) + echo "Usage: $0 [OPTIONS]" + echo + echo "The following options may be used for cross-building." + echo " --profile=N Use custom build profile (use in conjunction with \$CC)" + echo + echo "The following options may be used to modify installation behavior." + echo " --includedir=N Headers directory (default is ${PREFIX}/include)" + echo " --libdir=N Libraries directory (default is ${PREFIX}/lib)" + echo " --mandir=N Manual pages directory (default is ${PREFIX}/man)" + echo " --prefix=N Installs library files in N (default is $PREFIX)" + echo + echo "The following options will modify code generation." + echo " --cores=N Specify number of cores available on target machine" + echo " --enable-pointer-packing Assumes address encoding is subset of pointer range" + echo " --enable-rtm Enable restricted transactional memory (x86_64 only)" + echo " --memory-model=N Specify memory model (currently tso, pso or rmo)" + echo " --vma-bits=N Specify valid number of VMA bits" + echo + echo "The following environment variables may be used:" + echo " CC C compiler command" + echo " CFLAGS C compiler flags" + echo " LDFLAGS Linker flags" + echo " GZIP GZIP compression tool" + echo + echo "Report bugs to ${MAINTAINER}." + exit $EXIT_SUCCESS + ;; + --memory-model=*) + case "$value" in + "tso") + MM="CK_MD_TSO" + ;; + "rmo") + MM="CK_MD_RMO" + ;; + "pso") + MM="CK_MD_PSO" + ;; + *) + echo "./configure [--help]" + exit $EXIT_FAILURE + ;; + esac + ;; + --vma-bits=*) + VMA_BITS=$value + ;; + --enable-pointer-packing) + POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_ENABLE" + ;; + --enable-rtm) + RTM_ENABLE_SET="CK_MD_RTM_ENABLE" + ;; + --cores=*) + CORES=$value + ;; + --profile=*) + PROFILE=$value + ;; + --prefix=*) + PREFIX=$value + ;; + --includedir=*) + HEADERS=$value + ;; + --libdir=*) + LIBRARY=$value + ;; + --mandir=*) + MANDIR=$value + ;; + --with-pic) + WANT_PIC=yes + ;; + --without-pic) + WANT_PIC=no + ;; + --build=*|--host=*|--target=*|--exec-prefix=*|--bindir=*|--sbindir=*|\ + --sysconfdir=*|--datadir=*|--libexecdir=*|--localstatedir=*|\ + --enable-static|\ + --sharedstatedir=*|--infodir=*|--enable-shared|--disable-shared) + # ignore for compat with regular configure + ;; + --*) + echo "$0 [--help]" + echo "Unknown option $option" + exit $EXIT_FAILURE + ;; + *=*) + NAME=`expr "$option" : '\([^=]*\)='` + VALUE=`echo "$value" | sed "s/'/'\\\\\\\\''/g"` + eval "$NAME='$VALUE'" + export $NAME + ;; + *) + echo "$0 [--help]" + echo "Unknown option $option" + exit $EXIT_FAILURE + ;; + esac +done + +HEADERS=${HEADERS:-"${PREFIX}/include"} +LIBRARY=${LIBRARY:-"${PREFIX}/lib"} +MANDIR=${MANDIR:-"${PREFIX}/share/man"} +GZIP=${GZIP:-"gzip -c"} +POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"} +RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"} +VMA_BITS=${VMA_BITS:-"unknown"} + +if test "$PROFILE"; then + printf "Using user-specified profile....." + + if test -z "$CC"; then + echo "failed [specify compiler]" + exit $EXIT_FAILURE + fi + + if test ! -f build/ck.build.$PROFILE; then + echo "failed [$PROFILE]" + exit $EXIT_FAILURE + fi + + echo "success [$PROFILE]" + printf "Generating header files.........." + generate include/ck_md.h.in include/ck_md.h + echo "success" + printf "Generating build files..........." + generate doc/Makefile.in doc/Makefile + generate build/ck.build.in build/ck.build + generate build/regressions.build.in build/regressions.build + generate build/ck.pc.in build/ck.pc + generate build/ck.spec.in build/ck.spec + generate Makefile.in Makefile + echo "success" + generate_stdout + exit $EXIT_SUCCESS +fi + +DCORES=2 +printf "Detecting operating system......." +SYSTEM=`uname -s 2> /dev/null` +case "$SYSTEM" in + "SunOS") + SYSTEM=solaris + ;; + "Linux"|"uClinux") + DCORES=`egrep '(^CPU[0-9]+|^processor.*:.*)' /proc/cpuinfo|wc -l` + SYSTEM=linux + ;; + "FreeBSD"|"GNU/kFreeBSD") + DCORES=`sysctl -n hw.ncpu` + SYSTEM=freebsd + ;; + "NetBSD") + DCORES=`sysctl -n hw.ncpu` + SYSTEM=netbsd + ;; + "OpenBSD") + DCORES=`sysctl -n hw.ncpu` + SYSTEM=openbsd + ;; + "DragonFly") + DCORES=`sysctl -n hw.ncpu` + SYSTEM=dragonflybsd + ;; + "Darwin") + DCORES=`sysctl -n hw.ncpu` + SYSTEM=darwin + ;; + MINGW32*) + SYSTEM=mingw32 + LDFLAGS="-mthreads $LDFLAGS" + ;; + *) + SYSTEM= + ;; +esac + +assert "$SYSTEM" "$SYSTEM" "unsupported" + +CORES=${CORES:-${DCORES}} +printf "Detecting machine architecture..." +PLATFORM=`uname -m 2> /dev/null` +case $PLATFORM in + "macppc"|"Power Macintosh"|"powerpc") + RTM_ENABLE="CK_MD_RTM_DISABLE" + MM="${MM:-"CK_MD_RMO"}" + PLATFORM=ppc + ENVIRONMENT=32 + LDFLAGS="-m32 $LDFLAGS" + ;; + "sun4u"|"sun4v"|"sparc64") + RTM_ENABLE="CK_MD_RTM_DISABLE" + MM="${MM:-"CK_MD_TSO"}" + PLATFORM=sparcv9 + ENVIRONMENT=64 + LDFLAGS="-m64 $LDFLAGS" + ;; + i386|i486|i586|i686|i586_i686|pentium*|athlon*|k5|k6|k6_2|k6_3) + MM="${MM:-"CK_MD_TSO"}" + case $SYSTEM in + darwin) + ENVIRONMENT=64 + PLATFORM=x86_64 + ;; + freebsd) + PLATFORM=x86 + ENVIRONMENT=32 + + # FreeBSD doesn't give us a nice way to determine the CPU + # class of the running system, reporting any 32-bit x86 + # architecture as i386. 486 is its minimum supported CPU + # class and cmpxchg8b was implemented first in i586. + dmesg | grep -q "486-class" + if test "$?" -eq 0; then + assert "" "" "Must have an i586 class or higher CPU" + fi + + # FreeBSD still generates code for 486-class CPUs as its + # default 32-bit target, but we need 586 at the least. + echo "$CFLAGS" | grep -q 'march=' + if test "$?" -ne 0; then + # Needed for cmpxchg8b + CFLAGS="$CFLAGS -march=i586" + fi + ;; + linux) + case $PLATFORM in + i386|i486) + assert "" "" "Must have an i586 class or higher CPU" + ;; + esac + + PLATFORM=x86 + ENVIRONMENT=32 + ;; + + *) + PLATFORM=x86 + ENVIRONMENT=32 + assert "$PLATFORM $ENVIRONMENT" "$PLATFORM $ENVIRONMENT" "unsupported" + ;; + esac + ;; + "amd64"|"x86_64") + PLATFORM=x86_64 + ENVIRONMENT=64 + LDFLAGS="-m64 $LDFLAGS" + MM="${MM:-"CK_MD_TSO"}" + ;; + "i86pc") + RTM_ENABLE="CK_MD_RTM_DISABLE" + MM="${MM:-"CK_MD_TSO"}" + ISA=`isainfo -n 2> /dev/null || echo i386` + case "$ISA" in + "amd64") + RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"} + PLATFORM=x86_64 + ENVIRONMENT=64 + ;; + *) + PLATFORM=x86 + ENVIRONMENT=32 + assert "$PLATFORM $ENVIRONMENT" "$PLATFORM $ENVIRONMENT" "unsupported" + ;; + esac + ;; + "ppc64"|"ppc64le") + RTM_ENABLE="CK_MD_RTM_DISABLE" + MM="${MM:-"CK_MD_RMO"}" + PLATFORM=ppc64 + ENVIRONMENT=64 + ;; + arm|armv6l|armv7l) + RTM_ENABLE="CK_MD_RTM_DISABLE" + MM="${MM:-"CK_MD_RMO"}" + PLATFORM=arm + ENVIRONMENT=32 + ;; + "aarch64") + RTM_ENABLE="CK_MD_RTM_DISABLE" + MM="${MM:-"CK_MD_RMO"}" + PLATFORM=aarch64 + ENVIRONMENT=64 + ;; + *) + RTM_ENABLE="CK_MD_RTM_DISABLE" + PLATFORM= + MM="${MM:-"CK_MD_RMO"}" + ;; +esac + +assert "$PLATFORM" "$PLATFORM" "unsupported" + +if test "$VMA" = "unknown"; then + VMA_BITS_R="CK_MD_VMA_BITS_UNKNOWN" + VMA_BITS_VALUE_R="" + POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_DISABLE" +else + VMA_BITS_R="CK_MD_VMA_BITS" + VMA_BITS_VALUE_R="${VMA_BITS}ULL" +fi + +# `which` on Solaris sucks +pathsearch() +{ + what=$1 + oldFS="$IFS" + IFS=":" + for d in $PATH ; do + if test -x "$d/$what" ; then + echo "$d/$what"; + IFS="$oldFS" + return + fi + done + IFS="$oldFS" +} + +printf "Finding dirname command.........." +DIRNAME=`pathsearch "${DIRNAME:-dirname}"` +if test -z "$DIRNAME" -o ! -x "$DIRNAME"; then + DIRNAME=`pathsearch "${DIRNAME:-dirname}"` + DIRNAME="$DIRNAME" +else + echo "success [$DIRNAME]" +fi + +if test -z "$DIRNAME"; then + echo "not found (out of source build unsupported)" +else + printf "Determining build directory......" + + BUILD_DIR=`$DIRNAME $0` + cd `$DIRNAME $0` + BUILD_DIR=`pwd` + + echo "success [$BUILD_DIR]" +fi + +printf "Finding gzip tool................" +GZIP=`pathsearch "${GZIP:-gzip}"` +if test -z "$GZIP" -o ! -x "$GZIP"; then + GZIP=`pathsearch "${GZIP:-gzip}"` + GZIP="$GZIP" +fi + +if test -z "$GZIP"; then + echo "not found" + GZIP=cat + GZIP_SUFFIX="" +else + echo "success [$GZIP]" + GZIP="$GZIP -c" + GZIP_SUFFIX=".gz" +fi + +printf "Finding suitable compiler........" +CC=`pathsearch "${CC:-cc}"` +if test -z "$CC" -o ! -x "$CC"; then + CC=`pathsearch "${CC:-gcc}"` +fi +assert "$CC" "not found" + +cat << EOF > .1.c +#include <stdio.h> +int main(void) { +#if defined(_WIN32) +#if defined(__MINGW64__) + puts("mingw64"); + return (0); +#elif defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION >= 3) + puts("mingw32"); + return (0); +#else + return (1); +#endif /* __MINGW32__ && __MINGW32_MAJOR_VERSION >= 3 */ +#elif defined(__clang__) && (__clang_major__ >= 4) + puts("clang"); + return (0); +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5110) + puts("suncc"); + return (0); +#elif defined(__GNUC__) && (__GNUC__ >= 4) + puts("gcc"); + return (0); +#else + return (1); +#endif +} +EOF + +$CC -o .1 .1.c +COMPILER=`./.1` +r=$? +rm -f .1.c .1 + +if test "$r" -ne 0; then + assert "" "update compiler" +else + echo "success [$CC]" +fi + +if test "$COMPILER" = "suncc"; then + LD=/bin/ld + LDFLAGS="-G -z text -h libck.so.$VERSION_MAJOR $LDFLAGS" + CFLAGS="-xO5 $CFLAGS" + PTHREAD_CFLAGS="-mt -lpthread" +elif test "$COMPILER" = "gcc" || test "$COMPILER" = "clang" || test "$COMPILER" = "mingw32" || test "$COMPILER" = "mingw64"; then + LD=$CC + SONAME="$LDNAME_MAJOR" + if test "$SYSTEM" = "darwin"; then + CC_WL_OPT="-install_name" + LDNAME="libck.dylib" + LDNAME_VERSION="libck.$VERSION.dylib" + LDNAME_MAJOR="libck.$VERSION_MAJOR.dylib" + SONAME="$LIBRARY/$LDNAME_MAJOR" + else + CC_WL_OPT="-soname" + fi + + LDFLAGS="-Wl,$CC_WL_OPT,$SONAME $LDFLAGS" + if test "$WANT_PIC" = "yes"; then + LDFLAGS="$LDFLAGS -shared -fPIC" + CFLAGS="$CFLAGS -fPIC" + ALL_LIBS="libck.so libck.a" + INSTALL_LIBS="install-so install-lib" + else + LDFLAGS="$LDFLAGS -fno-PIC" + CFLAGS="$CFLAGS -fno-PIC" + ALL_LIBS="libck.a" + INSTALL_LIBS="install-lib" + fi + + CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS" + PTHREAD_CFLAGS="-pthread" + if test "$COMPILER" = "mingw64"; then + ENVIRONMENT=64 + PLATFORM=x86_64 + fi +else + assert "" "unknown compiler" +fi + +printf "Detecting VMA bits..............." +VMA="unknown" +if test "$VMA_BITS" = "unknown"; then + if test "$PLATFORM" = "x86" || test $PLATFORM = "x86_64"; then + case $SYSTEM in + darwin) + VMA=`sysctl -n machdep.cpu.address_bits.virtual` + ;; + linux) + VMA=`awk '/address sizes/ {print $7;exit}' /proc/cpuinfo` + ;; + *) + if test "$PLATFORM" = "x86"; then + VMA="32" + else + cat << EOF > .1.c + #include <stdio.h> + + int main(int argc, char *argv[]) + { + unsigned long ret = 0x80000000; + + __asm __volatile("cpuid\n" + : "+a" (ret)); + if (ret >= 0x80000008) { + ret = 0x80000008; + __asm __volatile("cpuid\n" + : "+a" (ret)); + printf("%lu\n", (ret >> 8) & 0xff); + } else { + return (1); + } + return (0); + } +EOF + + $CC -o .1 .1.c 2>/dev/null + VMA=`./.1 2>/dev/null` + if test $? -ne 0; then + VMA="unknown" + fi + rm -f .1.c .1 + fi + esac + fi + + VMA_BITS=$VMA +else + VMA=$VMA_BITS +fi + +if test "$VMA" = "unknown"; then + echo "unknown" + VMA_BITS_R="CK_MD_VMA_BITS_UNKNOWN" + VMA_BITS_VALUE_R="" + POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_DISABLE" +else + echo "success [$VMA]" + VMA_BITS_R="CK_MD_VMA_BITS" + VMA_BITS_VALUE_R="${VMA_BITS}ULL" +fi + +for i in $REQUIRE_HEADER; do + printf "Checking header file usability..." + + cat << EOF > .1.c +#include <$i> +int main(void){return(0);} +EOF + $CC -o .1 .1.c 2> /dev/null + hf_s=$? + + rm -f .1 .1.c + if test $hf_s -eq 0; then + echo "success [$i]" + else + echo "failed [$i]" + exit $EXIT_FAILURE + fi +done + +# Platform will be used as a macro. +PROFILE="${PROFILE:-$PLATFORM}" +PLATFORM="__${PLATFORM}__" + +printf "Generating header files.........." +generate include/ck_md.h.in include/ck_md.h +echo "success" + +printf "Generating build files..........." + +mkdir -p $P_PWD/doc +mkdir -p $P_PWD/build +mkdir -p $P_PWD/include +mkdir -p $P_PWD/src + +if test "$P_PWD" '!=' "$BUILD_DIR"; then + mkdir -p $P_PWD/regressions + cp $BUILD_DIR/regressions/Makefile.unsupported $P_PWD/regressions/Makefile &> /dev/null + cp $BUILD_DIR/build/ck.build.$PROFILE $P_PWD/build/ck.build.$PROFILE &> /dev/null + cp $BUILD_DIR/include/ck_md.h $P_PWD/include/ck_md.h &> /dev/null +fi + +generate src/Makefile.in $P_PWD/src/Makefile +generate doc/Makefile.in $P_PWD/doc/Makefile +generate build/ck.build.in $P_PWD/build/ck.build +generate build/regressions.build.in $P_PWD/build/regressions.build +generate build/ck.pc.in $P_PWD/build/ck.pc +generate build/ck.spec.in $P_PWD/build/ck.spec +generate Makefile.in $P_PWD/Makefile +touch src/*.c +echo "success" +generate_stdout + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_ARRAY_FOREACH ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_ARRAY_FOREACH b/lib/ck/doc/CK_ARRAY_FOREACH new file mode 100644 index 0000000..d85b767 --- /dev/null +++ b/lib/ck/doc/CK_ARRAY_FOREACH @@ -0,0 +1,79 @@ +.\" +.\" Copyright 2013 Samy Al Bahra. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 18, 2013 +.Dt CK_ARRAY_FOREACH 3 +.Sh NAME +.Nm CK_ARRAY_FOREACH +.Nd iterate through an array +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_array.h +.Ft bool +.Fn CK_ARRAY_FOREACH "ck_array_t *array" "ck_array_iterator_t *iterator" "void **b" +.Sh DESCRIPTION +The +.Fn CK_ARRAY_FOREACH 3 +macro iterates through the array pointed to by +.Fa array . +A pointer to an iterator object must be specified by +.Fa iterator +and +.Fa b +must point to a void pointer. +.Sh EXAMPLE +.Bd -literal -offset indent +#include <ck_array.h> + +/* Assume this was already previously initialized. */ +ck_array_t array; + +void +example(void) +{ + ck_array_iterator_t iterator; + void *pointer; + + CK_ARRAY_FOREACH(&array, &iterator, &pointer) { + do_something(pointer); + } +} +.Ed +.Sh RETURN VALUES +This macro has no return value. +.Sh SEE ALSO +.Xr ck_array_init 3 , +.Xr ck_array_commit 3 , +.Xr ck_array_put 3 , +.Xr ck_array_put_unique 3 , +.Xr ck_array_remove 3 , +.Xr ck_array_deinit 3 +.Xr ck_array_length 3 , +.Xr ck_array_buffer 3 , +.Xr ck_array_initialized 3 +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_COHORT_INIT ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_COHORT_INIT b/lib/ck/doc/CK_COHORT_INIT new file mode 100644 index 0000000..42a2294 --- /dev/null +++ b/lib/ck/doc/CK_COHORT_INIT @@ -0,0 +1,66 @@ +.\" +.\" Copyright 2013 Brendon Scheinman. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 24, 2013. +.Dt CK_COHORT_INIT 3 +.Sh NAME +.Nm CK_COHORT_INIT +.Nd initialize instance of a cohort type +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_cohort.h +.Fn CK_COHORT_INIT "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_lock" \ +"void *local_lock" "unsigned int pass_limit" +.Sh DESCRIPTION +Until a cohort instance is initialized using the CK_COHORT_INIT macro, any operations +involving it will have undefined behavior. After this macro has been called, the cohort +pointed to by the +.Fa cohort +argument will use the lock pointed to by +.Fa global_lock +as its global lock and the lock pointed to by +.Fa local_lock +as its local lock. +.Pp +The cohort will relinquish its global lock after +.Fa pass_limit +consecutive acquisitions of its local lock, even if there are other threads waiting. +If you are unsure of a value to use for the +.Fa pass_limit +argument, you should use CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT. +.Sh SEE ALSO +.Xr ck_cohort 3 , +.Xr CK_COHORT_PROTOTYPE 3 , +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 , +.Xr CK_COHORT_INSTANCE 3 , +.Xr CK_COHORT_INITIALIZER 3 , +.Xr CK_COHORT_LOCK 3 , +.Xr CK_COHORT_UNLOCK 3 , +.Xr CK_COHORT_LOCKED 3 , +.Xr CK_COHORT_TRYLOCK 3 , +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_COHORT_INSTANCE ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_COHORT_INSTANCE b/lib/ck/doc/CK_COHORT_INSTANCE new file mode 100644 index 0000000..cec1617 --- /dev/null +++ b/lib/ck/doc/CK_COHORT_INSTANCE @@ -0,0 +1,59 @@ +.\" +.\" Copyright 2013 Brendon Scheinman. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 24, 2013. +.Dt CK_COHORT_INSTANCE 3 +.Sh NAME +.Nm CK_COHORT_INSTANCE +.Nd declare an instance of a cohort type +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_cohort.h +.Fn CK_COHORT_INSTANCE "COHORT_NAME cohort_name" +.Sh DESCRIPTION +The user must use this macro to declare instances of cohort types that they have +defined. For instance, if they have used the CK_COHORT_PROTOTYPE macro to define +a cohort type with name foo, they would create an instance of this type as follows: +.br +CK_COHORT_INSTANCE(foo) cohort; +.Pp +This macro should also be used when allocating memory for cohorts. For instance, +to allocate a block of 4 cohorts: +.br +CK_COHORT_INSTANCE(foo) *cohorts = malloc(4 * sizeof(CK_COHORT_INSTANCE(foo))); +.Sh SEE ALSO +.Xr ck_cohort 3 , +.Xr CK_COHORT_PROTOTYPE 3 , +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 , +.Xr CK_COHORT_INSTANCE 3 , +.Xr CK_COHORT_INITIALIZER 3 , +.Xr CK_COHORT_LOCK 3 , +.Xr CK_COHORT_UNLOCK 3 , +.Xr CK_COHORT_LOCKED 3 , +.Xr CK_COHORT_TRYLOCK 3 , +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_COHORT_LOCK ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_COHORT_LOCK b/lib/ck/doc/CK_COHORT_LOCK new file mode 100644 index 0000000..df39ad4 --- /dev/null +++ b/lib/ck/doc/CK_COHORT_LOCK @@ -0,0 +1,61 @@ +.\" +.\" Copyright 2013 Brendon Scheinman. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 24, 2013. +.Dt CK_COHORT_LOCK 3 +.Sh NAME +.Nm CK_COHORT_LOCK +.Nd acquire cohort lock +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_cohort.h +.Fn CK_COHORT_LOCK "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_context" \ +"void *local_context" +.Sh DESCRIPTION +This call attempts to acquire both the local and global (if necessary) locks from +.Fa cohort . +The call will block until both locks have been acquired. +.Fa global_context +will be passed as the second argument to the function that was provided as the +.Fa global_lock_method +argument to CK_COHORT_PROTOTYPE if that method is called, and +.Fa local_context +will be passed to the function specified by +.Fa local_lock_method +. +.Sh SEE ALSO +.Xr ck_cohort 3 , +.Xr CK_COHORT_PROTOTYPE 3 , +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 , +.Xr CK_COHORT_INSTANCE 3 , +.Xr CK_COHORT_INITIALIZER 3 , +.Xr CK_COHORT_INIT 3 , +.Xr CK_COHORT_UNLOCK 3 , +.Xr CK_COHORT_LOCKED 3 , +.Xr CK_COHORT_TRYLOCK 3 , +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_COHORT_PROTOTYPE ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_COHORT_PROTOTYPE b/lib/ck/doc/CK_COHORT_PROTOTYPE new file mode 100644 index 0000000..f058fb8 --- /dev/null +++ b/lib/ck/doc/CK_COHORT_PROTOTYPE @@ -0,0 +1,76 @@ +.\" +.\" Copyright 2013 Brendon Scheinman. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 24, 2013. +.Dt CK_COHORT_PROTOTYPE 3 +.Sh NAME +.Nm CK_COHORT_PROTOTYPE +.Nd define cohort type with specified lock types +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_cohort.h +.Fn CK_COHORT_PROTOTYPE "COHORT_NAME cohort_name" "TYPE global_lock_method" \ +"LOCK_FXN global_unlock_method" "LOCK_FXN local_lock_method" "LOCK_FXN local_unlock_method" +.Sh DESCRIPTION +The ck_cohort.h header file does not define any cohort types. Instead, the user must use +the CK_COHORT_PROTOTYPE or +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 +macros to define any types they want to use. They must use CK_COHORT_TRYLOCK_PROTOTYPE +if they want their cohort type to support trylock operations. +The CK_COHORT_PROTOTYPE macro takes the following arguments: +.Pp +.Fa cohort_name +: An identifier used for this cohort type. This will have to be passed to each +of the other CK_COHORT macros. +.br +.Fa global_lock_method +: The method that should be called to acquire the global lock +.br +.Fa global_unlock_method +: The method that should be called to relinquish the global lock +.br +.Fa local_lock_method +: The method that should be called to acquire the local lock +.br +.Fa local_unlock_method +: The method that should be called to relinquish the local lock +.Pp +Instances of the defined cohort type can be declared as: +.br + CK_COHORT_INSTANCE(cohort_name) cohort; +.Sh SEE ALSO +.Xr ck_cohort 3 , +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 , +.Xr CK_COHORT_INSTANCE 3 , +.Xr CK_COHORT_INITIALIZER 3 , +.Xr CK_COHORT_INIT 3 , +.Xr CK_COHORT_LOCK 3 , +.Xr CK_COHORT_UNLOCK 3 , +.Xr CK_COHORT_LOCKED 3 , +.Xr CK_COHORT_TRYLOCK 3 , +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_COHORT_TRYLOCK ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_COHORT_TRYLOCK b/lib/ck/doc/CK_COHORT_TRYLOCK new file mode 100644 index 0000000..fd9306e --- /dev/null +++ b/lib/ck/doc/CK_COHORT_TRYLOCK @@ -0,0 +1,69 @@ +.\" +.\" Copyright 2013 Brendon Scheinman. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd March 9, 2013. +.Dt CK_COHORT_TRYLOCK 3 +.Sh NAME +.Nm CK_COHORT_TRYLOCK +.Nd try to acquire cohort lock +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_cohort.h +.Fn CK_COHORT_TRYLOCK "COHORT_NAME cohort_name" "COHORT *cohort" "void *global_trylock_context" \ +"void *local_trylock_context" "void *lock_unlock_context" +.Sh DESCRIPTION +This call attempts to acquire both the local and global (if necessary) locks from +.Fa cohort . +It can only be used with cohort types that were defined using the +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 +macro. The call will not block and will return a bool that will evaluate to true iff +the cohort was successfully acquired. +.Fa global_trylock_context +will be passed as the second argument to the function that was provided as the +.Fa global_trylock_method +argument to CK_COHORT_TRYLOCK_PROTOTYPE if that method is called, and +.Fa local_trylock_context +will be passed to the function specified by +.Fa local_trylock_method . +If the global lock acquisition fails, then the cohort will immediately release its +local lock as well, and +.Fa local_unlock_context +will be passed to the function specified by +.Fa local_unlock_method +when this call is made. +.Sh SEE ALSO +.Xr ck_cohort 3 , +.Xr CK_COHORT_PROTOTYPE 3 , +.Xr CK_COHORT_TRYLOCK_PROTOTYPE 3 , +.Xr CK_COHORT_INSTANCE 3 , +.Xr CK_COHORT_INITIALIZER 3 , +.Xr CK_COHORT_INIT 3 , +.Xr CK_COHORT_LOCK 3 , +.Xr CK_COHORT_UNLOCK 3 , +.Xr CK_COHORT_LOCKED 3 , +.Pp +Additional information available at http://concurrencykit.org/ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f098175e/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE ---------------------------------------------------------------------- diff --git a/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE b/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE new file mode 100644 index 0000000..7edc032 --- /dev/null +++ b/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE @@ -0,0 +1,90 @@ +.\" +.\" Copyright 2013 Brendon Scheinman. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd March 9, 2013. +.Dt CK_COHORT_TRYLOCK_PROTOTYPE 3 +.Sh NAME +.Nm CK_COHORT_TRYLOCK_PROTOTYPE +.Nd define cohort type with specified lock types +.Sh LIBRARY +Concurrency Kit (libck, \-lck) +.Sh SYNOPSIS +.In ck_cohort.h +.Fn CK_COHORT_TRYLOCK_PROTOTYPE "COHORT_NAME cohort_name" "LOCK_FXN global_lock_method" \ +"LOCK_FXN global_unlock_method" "BOOL_LOCK_FXN global_locked_method" \ +"BOOL_LOCK_FXN global_trylock_method" "LOCK_FXN local_lock_method" \ +"LOCK_FXN local_unlock_method" "BOOL_LOCK_FXN local_locked_method" "BOOL_LOCK_FXN local_trylock_method" +.Sh DESCRIPTION +The ck_cohort.h header file does not define any cohort types. Instead, the user must use +the CK_COHORT_PROTOTYPE or CK_COHORT_TRYLOCK_PROTOTYPE macros to define any types +they want to use. They must use CK_COHORT_TRYLOCK_PROTOTYPE if they want their cohort type to have support +for trylock operations. The CK_COHORT_TRYLOCK_PROTOTYPE macro takes the following arguments: +.Pp +.Fa cohort_name +: An identifier used for this cohort type. This will have to be passed to each +of the other CK_COHORT macros. +.br +.Fa global_lock_method +: The method that should be called to acquire the global lock +.br +.Fa global_unlock_method +: The method that should be called to relinquish the global lock +.br +.Fa global_locked_method +: This method should return true iff the global lock is acquired by a thread. +.br +.Fa global_trylock_method +: The method that should be called to try to acquire the global lock. +It should not block and return true iff the lock was successfully acquired. +.br +.Fa local_lock_method +: The method that should be called to acquire the local lock +.br +.Fa local_unlock_method +: The method that should be called to relinquish the local lock +.br +.Fa global_locked_method +: This method should return true iff the global lock is acquired by a thread. +.br +.Fa local_trylock_method +: The method that should be called to try to acquire the local lock. +It should not block and return true iff the lock was successfully acquired. +.Pp +Instances of the defined cohort type can be declared as: +.br + CK_COHORT_INSTANCE(cohort_name) cohort; +.Sh SEE ALSO +.Xr ck_cohort 3 , +.Xr CK_COHORT_PROTOTYPE 3 , +.Xr CK_COHORT_INSTANCE 3 , +.Xr CK_COHORT_INITIALIZER 3 , +.Xr CK_COHORT_INIT 3 , +.Xr CK_COHORT_LOCK 3 , +.Xr CK_COHORT_UNLOCK 3 , +.Xr CK_COHORT_LOCKED 3 , +.Xr CK_COHORT_TRYLOCK 3 , +.Pp +Additional information available at http://concurrencykit.org/