| 3178 | } |
| 3179 | |
| 3180 | ACTOR Future<TLogLockResult> TagPartitionedLogSystem::lockTLog( |
| 3181 | UID myID, |
| 3182 | Reference<AsyncVar<OptionalInterface<TLogInterface>>> tlog) { |
| 3183 | |
| 3184 | TraceEvent("TLogLockStarted", myID).detail("TLog", tlog->get().id()).detail("InfPresent", tlog->get().present()); |
| 3185 | loop { |
| 3186 | choose { |
| 3187 | when(TLogLockResult data = wait( |
| 3188 | tlog->get().present() ? brokenPromiseToNever(tlog->get().interf().lock.getReply<TLogLockResult>()) |
| 3189 | : Never())) { |
| 3190 | TraceEvent("TLogLocked", myID).detail("TLog", tlog->get().id()).detail("End", data.end); |
| 3191 | return data; |
| 3192 | } |
| 3193 | when(wait(tlog->onChange())) {} |
| 3194 | } |
| 3195 | } |
| 3196 | } |