Skip to content

Commit e219fa8

Browse files
Tensorstore Teamcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 794384098 Change-Id: I771fa9400ab9dfca89d803ff5d5144d2406243b3
1 parent 40f9ef9 commit e219fa8

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

tensorstore/util/future.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ CallbackPointer FutureStateBase::RegisterReadyCallback(
100100
ReadyCallbackBase* callback) {
101101
assert(callback->reference_count_.load(std::memory_order_relaxed) >= 2);
102102
{
103-
absl::MutexLock lock(GetMutex(this));
103+
absl::MutexLock lock(*GetMutex(this));
104104
future_ready_callbacks.Increment();
105105
if (!this->ready()) {
106106
InsertBefore(CallbackListAccessor{}, &ready_callbacks_, callback);
@@ -115,7 +115,7 @@ CallbackPointer FutureStateBase::RegisterNotNeededCallback(
115115
ResultNotNeededCallbackBase* callback) {
116116
assert(callback->reference_count_.load(std::memory_order_relaxed) >= 2);
117117
{
118-
absl::MutexLock lock(GetMutex(this));
118+
absl::MutexLock lock(*GetMutex(this));
119119
future_not_needed_callbacks.Increment();
120120
if (result_needed()) {
121121
InsertBefore(CallbackListAccessor{}, &promise_callbacks_, callback);
@@ -131,7 +131,7 @@ CallbackPointer FutureStateBase::RegisterForceCallback(
131131
assert(callback->reference_count_.load(std::memory_order_relaxed) >= 2);
132132
auto* mutex = GetMutex(this);
133133
{
134-
absl::MutexLock lock(mutex);
134+
absl::MutexLock lock(*mutex);
135135
future_force_callbacks.Increment();
136136
const auto state = state_.load(std::memory_order_acquire);
137137
if ((state & kResultLocked) != 0 || !has_future()) {
@@ -149,7 +149,7 @@ CallbackPointer FutureStateBase::RegisterForceCallback(
149149
already_forced:
150150
callback->OnForced();
151151
if (callback->callback_type() == CallbackBase::kLinkCallback) {
152-
absl::MutexLock lock(mutex);
152+
absl::MutexLock lock(*mutex);
153153
// For a `kLinkCallback` callback, if the result is still needed, register
154154
// the callback.
155155
if (result_needed()) {
@@ -174,7 +174,7 @@ void CallbackBase::Unregister(bool block) noexcept {
174174
auto* shared_state = this->shared_state();
175175
auto* mutex = GetMutex(shared_state);
176176
{
177-
absl::MutexLock lock(mutex);
177+
absl::MutexLock lock(*mutex);
178178
if (next == this) {
179179
// Already unregistered, do nothing.
180180
return;
@@ -240,7 +240,7 @@ inline void RunAndReleaseCallbacks(FutureStateBase* shared_state,
240240
while (true) {
241241
CallbackListNode* next_node;
242242
{
243-
absl::MutexLock lock(mutex);
243+
absl::MutexLock lock(*mutex);
244244
if (prev_node != nullptr) {
245245
// Reset prev_node->next pointer, which marks that the callback has
246246
// finished running.
@@ -317,7 +317,7 @@ void RunForceCallbacks(FutureStateBase* shared_state) {
317317
while (true) {
318318
CallbackListNode* next_node;
319319
{
320-
absl::MutexLock lock(mutex);
320+
absl::MutexLock lock(*mutex);
321321
if (prev_node) {
322322
// Reset prev_node->next pointer, which marks that the callback has
323323
// finished running.
@@ -332,9 +332,9 @@ void RunForceCallbacks(FutureStateBase* shared_state) {
332332
// may be blocked waiting for this callback to be unregistered by
333333
// another thread.
334334
prev_node->next = prev_node.get();
335-
mutex->Unlock();
335+
mutex->unlock();
336336
static_cast<CallbackBase*>(prev_node.get())->OnUnregistered();
337-
mutex->Lock();
337+
mutex->lock();
338338
} else {
339339
// Add back to promise_callbacks_ list.
340340
prev_node->running_callback_thread.~Id();
@@ -488,7 +488,7 @@ bool FutureStateBase::WaitFor(absl::Duration duration) noexcept {
488488
absl::Mutex* mutex = GetMutex(this);
489489
bool is_ready = mutex->LockWhenWithTimeout(
490490
absl::Condition(this, &FutureStateBase::ready), duration);
491-
mutex->Unlock();
491+
mutex->unlock();
492492
return is_ready;
493493
}
494494

@@ -498,7 +498,7 @@ bool FutureStateBase::WaitUntil(absl::Time deadline) noexcept {
498498
absl::Mutex* mutex = GetMutex(this);
499499
bool is_ready = mutex->LockWhenWithDeadline(
500500
absl::Condition(this, &FutureStateBase::ready), deadline);
501-
mutex->Unlock();
501+
mutex->unlock();
502502
return is_ready;
503503
}
504504

@@ -507,7 +507,7 @@ void FutureStateBase::Wait() noexcept {
507507
Force();
508508
absl::Mutex* mutex = GetMutex(this);
509509
mutex->LockWhen(absl::Condition(this, &FutureStateBase::ready));
510-
mutex->Unlock();
510+
mutex->unlock();
511511
}
512512

513513
FutureStateBase::~FutureStateBase() {

tensorstore/util/stop_token_impl.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bool StopState::RequestStop() {
3939
StopCallbackInvocationState invocation_state{
4040
/*thread_id=*/std::this_thread::get_id(), /*callback_destroyed=*/false};
4141

42-
absl::MutexLock lock(&mutex_);
42+
absl::MutexLock lock(mutex_);
4343
if (stop_requested_) return false;
4444
stop_requested_ = true;
4545

@@ -66,9 +66,9 @@ bool StopState::RequestStop() {
6666

6767
// Invoke the callback with the mutex unlocked.
6868
{
69-
mutex_.Unlock();
69+
mutex_.unlock();
7070
cur_callback->invoker_(*cur_callback);
71-
mutex_.Lock();
71+
mutex_.lock();
7272
}
7373

7474
if (invocation_state.callback_destroyed) {
@@ -93,7 +93,7 @@ bool StopState::RequestStop() {
9393

9494
void StopState::UnregisterImpl(StopCallbackBase& callback) {
9595
{
96-
absl::MutexLock lock(&mutex_);
96+
absl::MutexLock lock(mutex_);
9797

9898
if (callback.next != nullptr) {
9999
// Callback has not yet been invoked; it's safe to remove.
@@ -131,7 +131,7 @@ void StopState::UnregisterImpl(StopCallbackBase& callback) {
131131
void StopState::RegisterImpl(StopCallbackBase& callback) {
132132
bool stop_requested;
133133
{
134-
absl::MutexLock lock(&mutex_);
134+
absl::MutexLock lock(mutex_);
135135
stop_requested = stop_requested_;
136136
if (!stop_requested) {
137137
intrusive_ptr_increment(this);

0 commit comments

Comments
 (0)