ck_epoch_recycle(3)

ck_epoch_recycle3

Return an epoch record that may be used by caller

Usage

#include <ck_epoch.h>

ck_epoch_record_t *

ck_epoch_recycle(ck_epoch_t *epoch);

Library

Concurrency Kit (libck, -lck)

Overview

The ck_epoch_recycle(3) function attempts to return an unused epoch record object for use by the caller. These epoch records were associated with previous calls to the ck_epoch_unregister(3) function.

Examples

#include <ck_epoch.h>
#include <stdlib.h>
/*
 * epoch was previously initialized with ck_epoch_init.
 */
ck_epoch_t *epoch;
void
function(void)
{
	ck_epoch_record_t *record;
	record = ck_epoch_recycle(&epoch);
	if (record == NULL) {
		record = malloc(sizeof *record);
		if (record == NULL)
			return;
		ck_epoch_register(&epoch, record, NULL);
	}
	/*
	 * After we are done, we will unregister the record so it
	 * can be used by other new participants in the epoch system
	 * provided by the object pointed to by "epoch".
	 */
	ck_epoch_unregister(&epoch, record);
	return;
}

Return values

This function returns a pointer to a ck_epoch_record_t object. If no unused record was found to be associated with the object pointed to by epoch, then the function will return NULL.

Errors

Behavior is undefined if the object pointed to by epoch is not a valid epoch object.

Releases

5 releases since Debian 8 (Jessie); the text changed 1 time.

  1. 8–12
  2. 13

From libck-dev 0.7.2-6 in Debian 13 (Trixie). Parsed by carta from the page's mdoc source.