1CK_EPOCH_RECYCLE(3)      BSD Library Functions Manual      CK_EPOCH_RECYCLE(3)
2

NAME

4     ck_epoch_recycle — return an epoch record that may be used by caller
5

LIBRARY

7     Concurrency Kit (libck, -lck)
8

SYNOPSIS

10     #include <ck_epoch.h>
11
12     ck_epoch_record_t *
13     ck_epoch_recycle(ck_epoch_t *epoch);
14

DESCRIPTION

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

EXAMPLE

21           #include <ck_epoch.h>
22           #include <stdlib.h>
23
24           /*
25            * epoch was previously initialized with ck_epoch_init.
26            */
27           ck_epoch_t *epoch;
28
29           void
30           function(void)
31           {
32                   ck_epoch_record_t *record;
33
34                   record = ck_epoch_recycle(&epoch);
35                   if (record == NULL) {
36                           record = malloc(sizeof *record);
37                           if (record == NULL)
38                                   return;
39
40                           ck_epoch_register(&epoch, record);
41                   }
42
43                   /*
44                    * After we are done, we will unregister the record so it
45                    * can be used by other new participants in the epoch system
46                    * provided by the object pointed to by "epoch".
47                    */
48                   ck_epoch_unregister(&epoch, record);
49                   return;
50           }
51

RETURN VALUES

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

ERRORS

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

SEE ALSO

62     ck_epoch_init(3), ck_epoch_register(3), ck_epoch_unregister(3),
63     ck_epoch_poll(3), ck_epoch_synchronize(3), ck_epoch_reclaim(3),
64     ck_epoch_barrier(3), ck_epoch_call(3), ck_epoch_begin(3), ck_epoch_end(3)
65
66     Additional information available at http://concurrencykit.org/
67
68                               September 2, 2012
Impressum