Skip to content

Commit 4a0e4f7

Browse files
authored
CPP-987 Make handling of future callbacks play nicely with the predicate guards around cass_future_wait (#559)
1 parent d56c47f commit 4a0e4f7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/future.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,18 @@ bool Future::set_callback(Future::Callback callback, void* data) {
189189
}
190190

191191
void Future::internal_set(ScopedMutex& lock) {
192-
is_set_ = true;
193192
if (callback_) {
194193
Callback callback = callback_;
195194
void* data = data_;
196195
lock.unlock();
197196
callback(CassFuture::to(this), data);
198197
lock.lock();
199198
}
199+
200+
// CPP-987 Set this after the callbacks run to avoid unexpected exits
201+
// from wait ops due to spurious wakeups
202+
is_set_ = true;
203+
200204
// Broadcast after we've run the callback so that threads waiting
201205
// on this future see the side effects of the callback.
202206
uv_cond_broadcast(&cond_);

0 commit comments

Comments
 (0)