#include <list>
+#include "absl/time/time.h"
+
#include "src/core/lib/gprpp/thd.h"
+#include "src/core/lib/gprpp/time_util.h"
#include "src/core/lib/iomgr/ev_apple.h"
grpc_core::DebugOnlyTraceFlag grpc_apple_polling_trace(false, "apple_polling");
/// Drive the run loop in a global singleton thread until the global run loop is
/// shutdown.
static void GlobalRunLoopFunc(void* arg) {
- grpc_core::ReleasableMutexLock lock(&gGlobalRunLoopContext->mu);
+ grpc_core::LockableAndReleasableMutexLock lock(&gGlobalRunLoopContext->mu);
gGlobalRunLoopContext->run_loop = CFRunLoopGetCurrent();
gGlobalRunLoopContext->init_cv.Signal();
gGlobalRunLoopContext->input_source_cv.Wait(&gGlobalRunLoopContext->mu);
}
gGlobalRunLoopContext->input_source_registered = false;
- lock.Unlock();
+ lock.Release();
CFRunLoopRun();
lock.Lock();
}
- lock.Unlock();
+ lock.Release();
}
// pollset implementation
auto it = apple_pollset->workers.begin();
while (!actual_worker.kicked && !apple_pollset->is_shutdown) {
- if (actual_worker.cv.Wait(
- &apple_pollset->mu,
- grpc_millis_to_timespec(deadline, GPR_CLOCK_REALTIME))) {
+ if (actual_worker.cv.WaitWithDeadline(
+ &apple_pollset->mu, grpc_core::ToAbslTime(grpc_millis_to_timespec(
+ deadline, GPR_CLOCK_REALTIME)))) {
// timed out
break;
}
static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) {
GRPC_POLLING_TRACE("pollset init: %p", pollset);
GrpcApplePollset* apple_pollset = new (pollset) GrpcApplePollset();
- *mu = apple_pollset->mu.get();
+ *mu = grpc_core::GetUnderlyingGprMu(&apple_pollset->mu);
}
/// The caller must acquire the lock GrpcApplePollset.mu before calling this