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

# ck\_epoch\_recycle(3)

return an epoch record that may be used by caller

## NAME

**ck\_epoch\_recycle** – return an epoch record that may be used by caller

## LIBRARY

Concurrency Kit (libck, -lck)

## SYNOPSIS

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

*ck\_epoch\_record\_t* *\**\

**ck\_epoch\_recycle**(*ck\_epoch\_t \*epoch*);

## DESCRIPTION

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.

## EXAMPLE

```
#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.

## SEE ALSO

[ck\_epoch\_init(3)](/ck_epoch_init/3.md), [ck\_epoch\_register(3)](/ck_epoch_register/3.md), [ck\_epoch\_unregister(3)](/ck_epoch_unregister/3.md), [ck\_epoch\_poll(3)](/ck_epoch_poll/3.md), [ck\_epoch\_synchronize(3)](/ck_epoch_synchronize/3.md), [ck\_epoch\_reclaim(3)](/ck_epoch_reclaim/3.md), [ck\_epoch\_barrier(3)](/ck_epoch_barrier/3.md), [ck\_epoch\_call(3)](/ck_epoch_call/3.md), [ck\_epoch\_begin(3)](/ck_epoch_begin/3.md), [ck\_epoch\_end(3)](/ck_epoch_end/3.md)

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