---
name: "CK_RWCOHORT_INSTANCE"
section: "3"
platform: "linux"
package: "libck-dev"
version: "0.7.2-6"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/CK_RWCOHORT_INSTANCE"
---

# CK\_RWCOHORT\_INSTANCE(3)

declare an instance of a cohort-based reader-writer lock type

## NAME

**CK\_RWCOHORT\_INSTANCE** – declare an instance of a cohort-based reader-writer lock type

## LIBRARY

Concurrency Kit (libck, -lck)

## SYNOPSIS

**#include \<ck\_cohort.h\>**

**CK\_RWCOHORT\_NEUTRAL\_INSTANCE**(*COHORT\_NAME cohort\_name*);

**CK\_RWCOHORT\_RP\_INSTANCE**(*COHORT\_NAME cohort\_name*);

**CK\_RWCOHORT\_WP\_INSTANCE**(*COHORT\_NAME cohort\_name*);

## DESCRIPTION

The user must use this macro to declare instances of lock types that they have defined using the [CK\_RWCOHORT\_PROTOTYPE(3)](/CK_RWCOHORT_PROTOTYPE/3.md) macro.  The cohort\_name must be the same as the one used in the prototype macro. For instance, if CK\_RWCOHORT\_PROTOTYPE was called with the name "foo", the CK\_RWCOHORT\_INSTANCE macro should be called as\
 CK\_RWCOHORT\_INSTANCE(foo) cohort;

This macro should also be used when allocating memory for cohorts.  For instance, to allocate a block of 4 cohorts:\
 CK\_RWCOHORT\_WP\_INSTANCE(foo) \*cohorts = malloc(4 \* sizeof(CK\_RWCOHORT\_WP\_INSTANCE(foo)));

## SEE ALSO

[ck\_rwcohort(3)](/ck_rwcohort/3.md), [CK\_RWCOHORT\_PROTOTYPE(3)](/CK_RWCOHORT_PROTOTYPE/3.md), CK\_RWCOHORT\_TRYLOCK\_PROTOTYPE(3), [CK\_RWCOHORT\_INSTANCE(3)](/CK_RWCOHORT_INSTANCE/3.md), CK\_RWCOHORT\_INITIALIZER(3), CK\_RWCOHORT\_LOCK(3), CK\_RWCOHORT\_UNLOCK(3), CK\_RWCOHORT\_LOCKED(3), CK\_RWCOHORT\_TRYLOCK(3),

Additional information available at http://concurrencykit.org/
