| 118 | } |
| 119 | |
| 120 | void |
| 121 | commit(T *data) |
| 122 | { |
| 123 | // wait until existing commits finish, avoid race conditions |
| 124 | auto commit_lock = AcidCommitLock(AcidCommitMutexGet(&data_ptr)); |
| 125 | // wait until we have exclusive pointer access. |
| 126 | auto ptr_lock = AcidPtrLock(AcidPtrMutexGet(&data_ptr)); |
| 127 | // overwrite the pointer |
| 128 | data_ptr.reset(data); |
| 129 | //[end scope] unlock commit_lock & ptr_lock |
| 130 | } |
| 131 | |
| 132 | AcidCommitPtr<T> |
| 133 | startCommit() |