| 546 | }; |
| 547 | |
| 548 | TFE_ExecuteOpNotification* TFE_ExecuteOpInNewThread(TFE_Op* op, |
| 549 | TFE_TensorHandle** retvals, |
| 550 | int* num_retvals, |
| 551 | TF_Status* status) { |
| 552 | TFE_ExecuteOpNotification* n = new TFE_ExecuteOpNotification; |
| 553 | |
| 554 | n->thread.reset(op->operation.EagerContext()->TFEnv()->StartThread( |
| 555 | tensorflow::ThreadOptions(), "ExecuteOpThread", |
| 556 | [op, retvals, num_retvals, n]() { |
| 557 | TFE_Execute(op, retvals, num_retvals, n->status.get()); |
| 558 | n->n.Notify(); |
| 559 | })); |
| 560 | |
| 561 | return n; |
| 562 | } |
| 563 | |
| 564 | void TFE_ExecuteOpNotificationWaitAndDelete( |
| 565 | TFE_ExecuteOpNotification* notification, TF_Status* status) { |