| 115 | Rendezvous::~Rendezvous() {} |
| 116 | |
| 117 | Status Rendezvous::Recv(const ParsedKey& key, const Args& recv_args, |
| 118 | Tensor* val, bool* is_dead, int64 timeout_ms) { |
| 119 | Status ret; |
| 120 | Notification n; |
| 121 | RecvAsync(key, recv_args, |
| 122 | [&ret, &n, val, is_dead](const Status& s, const Args& send_args, |
| 123 | const Args& recv_args, const Tensor& v, |
| 124 | const bool dead) { |
| 125 | ret = s; |
| 126 | *val = v; |
| 127 | *is_dead = dead; |
| 128 | n.Notify(); |
| 129 | }); |
| 130 | if (timeout_ms > 0) { |
| 131 | int64 timeout_us = timeout_ms * 1000; |
| 132 | bool notified = WaitForNotificationWithTimeout(&n, timeout_us); |
| 133 | if (!notified) { |
| 134 | return Status(error::DEADLINE_EXCEEDED, |
| 135 | "Timed out waiting for notification"); |
| 136 | } |
| 137 | } else { |
| 138 | n.WaitForNotification(); |
| 139 | } |
| 140 | return ret; |
| 141 | } |
| 142 | |
| 143 | Status Rendezvous::Recv(const ParsedKey& key, const Args& args, Tensor* val, |
| 144 | bool* is_dead) { |