CK_ARRAY_INIT(3)
π CK_ARRAY_INIT(3) β the one where you birth a pointer array π
okay bestie, listen. this is ck_array_init from the Concurrency Kit, and yes she's a libck girlie β you link her with -lck. π
β¨ NAME β¨
ck_array_init β initialize a pointer array. that's it. that's the whole job. she sets it up so you can play. π¦
π LIBRARY π
Concurrency Kit (libck, -lck) β so like, remember to actually link the library, no cap. π₯
πΈ SYNOPSIS πΈ
#include <ck_array.h>
bool
ck_array_init(ck_array_t *array, unsigned int mode,
struct ck_malloc *allocator, unsigned int initial_length);
look at her. four arguments. iconic behavior. π
π DESCRIPTION π
so ck_array_init(3) initializes the array that array points at. like, that's her whole thing, she takes the pointer you hand her and makes it a real, functional array. periodt. β¨
the mode value must be CK_ARRAY_MODE_SPMC β no other mode, don't try it, she will not entertain you. π
the allocator argument must point to a ck_malloc data structure where the function pointers for malloc, free and realloc are all initialized and non-NULL. all three. every single one. if you leave one NULL it's giving chaos and we don't do that here. π
and initial_length? that specifies the initial length of the array. and here's the vibe check: the value of initial_length must be greater than or equal to 2. lowkey non-negotiable. π
now the slay part: an array allows for one concurrent put or remove operation in the presence of any number of concurrent CK_ARRAY_FOREACH operations. yes bestie, ONE writer-adjacent operation while literally unlimited foreach operations run alongside it. that's the whole flex. π
π«Ά RETURN VALUES π«Ά
- returns
trueif the array was successfully created π - returns
falseif the creation failed π
and when does it fail? failure may occur due to internal memory allocation failures, or because you passed invalid arguments. (so like, read the DESCRIPTION again if you got a false. she told you. π)
β SEE ALSO β
ck_array_commit(3)ck_array_put(3)ck_array_put_unique(3)ck_array_remove(3)ck_array_deinit(3)ck_array_length(3)ck_array_buffer(3)ck_array_initialized(3)CK_ARRAY_FOREACH(3)
additional information available at http://concurrencykit.org/ β go read it, iykyk πβ¨
and that's the page bestie!! this whole thing is from the CK_ARRAY_INIT(3) manual page, dated October 18, 2013. she's been serving since 2013 and she has not missed a day. mwah ππ
π¦ where this page comes from
- alpine 3.24: ck-doc 0.7.2-r1 Β· BSD-2-Clause AND Apache-2.0
- debian bookworm: libck-dev 0.7.1-10 Β· BSD-2-Clause
- debian trixie: libck-dev 0.7.2-6 Β· BSD-2-Clause
- epel 10: ck-devel 0.7.2-1.el10_1 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- epel 9: ck-devel 0.7.0-10.el9 Β· BSD
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- nixos 26.05: ck 0.7.2
- nixpkgs unstable: ck 0.7.2
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- ubuntu jammy: libck-dev 0.7.1-6ubuntu2 Β· BSD-2-Clause
- ubuntu noble: libck-dev 0.7.1-13build1 Β· BSD-2-Clause
- ubuntu questing: libck-dev 0.7.2-5ubuntu1
- ubuntu resolute: libck-dev 0.7.2-5ubuntu2 Β· BSD-2-Clause
- ubuntu stonking: libck-dev 0.7.2-11 Β· BSD-2-Clause
- Copyright 2012-2013 Samy Al Bahra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms