Scroll to navigation

CK_COHORT_TRYLOCK_PROTOTYPE(3) Library Functions Manual CK_COHORT_TRYLOCK_PROTOTYPE(3)

NAME

CK_COHORT_TRYLOCK_PROTOTYPEdefine 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_PROTOTYPE(3), CK_COHORT_INSTANCE(3), CK_COHORT_INITIALIZER(3), CK_COHORT_INIT(3), CK_COHORT_LOCK(3), CK_COHORT_UNLOCK(3), CK_COHORT_LOCKED(3), CK_COHORT_TRYLOCK(3),

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

March 9, 2013.