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

# CK\_COHORT\_TRYLOCK\_PROTOTYPE(3)

define cohort type with specified lock types

## NAME

**CK\_COHORT\_TRYLOCK\_PROTOTYPE** – define cohort type with specified lock types

## LIBRARY

Concurrency Kit (libck, -lck)

## SYNOPSIS

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

**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*);

## 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:

*cohort\_name* : An identifier used for this cohort type.  This will have to be passed to each of the other CK\_COHORT macros.\
 *global\_lock\_method* : The method that should be called to acquire the global lock\
 *global\_unlock\_method* : The method that should be called to relinquish the global lock\
 *global\_locked\_method* : This method should return true iff the global lock is acquired by a thread.\
 *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.\
 *local\_lock\_method* : The method that should be called to acquire the local lock\
 *local\_unlock\_method* : The method that should be called to relinquish the local lock\
 *global\_locked\_method* : This method should return true iff the global lock is acquired by a thread.\
 *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.

Instances of the defined cohort type can be declared as:\
\
     CK\_COHORT\_INSTANCE(cohort\_name) cohort;

## SEE ALSO

[ck\_cohort(3)](/ck_cohort/3.md), [CK\_COHORT\_PROTOTYPE(3)](/CK_COHORT_PROTOTYPE/3.md), [CK\_COHORT\_INSTANCE(3)](/CK_COHORT_INSTANCE/3.md), CK\_COHORT\_INITIALIZER(3), [CK\_COHORT\_INIT(3)](/CK_COHORT_INIT/3.md), [CK\_COHORT\_LOCK(3)](/CK_COHORT_LOCK/3.md), [CK\_COHORT\_UNLOCK(3)](/CK_COHORT_UNLOCK/3.md), CK\_COHORT\_LOCKED(3), [CK\_COHORT\_TRYLOCK(3)](/CK_COHORT_TRYLOCK/3.md),

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