15#ifndef ACTIONENGINE_PYBIND11_ACTIONENGINE_UTILS_H_ 
   16#define ACTIONENGINE_PYBIND11_ACTIONENGINE_UTILS_H_ 
   20#include <absl/status/statusor.h> 
   21#include <pybind11/attr.h> 
   22#include <pybind11/cast.h> 
   23#include <pybind11/pybind11.h> 
   24#include <pybind11/pytypes.h> 
   26namespace act::pybindings {
 
   28namespace py = ::pybind11;
 
   40auto MakeSameObjectRefConstructor() {
 
   41  return py::init([](
const std::shared_ptr<T>& other) { 
return other; });
 
   58std::shared_ptr<T> ShareWithNoDeleter(T* ptr) {
 
   59  return std::shared_ptr<T>(ptr, [](T*) {});
 
   73py::object& GetGloballySavedEventLoop();
 
   86void SaveEventLoopGlobally(
const py::object& loop);
 
   88void SaveFirstEncounteredEventLoop();
 
  136absl::StatusOr<py::object> RunThreadsafeIfCoroutine(
 
  137    py::object function_call_result, py::object loop = py::none(),
 
  138    bool return_future = 
false);
 
  145struct pybind11::detail::process_attribute<
 
  147    : process_attribute_default<act::pybindings::keep_event_loop_memo> {
 
  148  static void precall(function_call&) {
 
  149    act::pybindings::SaveFirstEncounteredEventLoop();
 
Annotation for PyBind11 functions to indicate that the event loop should be tracked and saved as a gl...
Definition utils_pybind11.h:106