* Defers the execution of the function pointed to by the "cb" * argument until an epoch counter loop. This allows for a * non-blocking deferral. * * We can get away without a fence here due to the monotonic nature * of the epoch counter. Worst case, this will result in some delays * before object destruction. */
| 193 | * before object destruction. |
| 194 | */ |
| 195 | CK_CC_FORCE_INLINE static void |
| 196 | ck_epoch_call(ck_epoch_record_t *record, |
| 197 | ck_epoch_entry_t *entry, |
| 198 | ck_epoch_cb_t *function) |
| 199 | { |
| 200 | struct ck_epoch *epoch = record->global; |
| 201 | unsigned int e = ck_pr_load_uint(&epoch->epoch); |
| 202 | unsigned int offset = e & (CK_EPOCH_LENGTH - 1); |
| 203 | |
| 204 | record->n_pending++; |
| 205 | entry->function = function; |
| 206 | ck_stack_push_spnc(&record->pending[offset], &entry->stack_entry); |
| 207 | return; |
| 208 | } |
| 209 | |
| 210 | /* |
| 211 | * Same as ck_epoch_call, but allows for records to be shared and is reentrant. |
no test coverage detected