gdbpy_ref<>
py_get_event_thread (ptid_t ptid)
{
  if (non_stop)
    {
      thread_info *thread = find_thread_ptid (ptid);
      if (thread != nullptr)
	return thread_to_thread_object (thread);
      PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
      return NULL;
    }
  return gdbpy_ref<>::new_reference (Py_None);
}
static PyObject *
get_event_thread (void)
{
  PyObject *thread;

  if (non_stop)
    thread = (PyObject *) thread_to_thread_object (inferior_thread ());
  else
    thread = Py_None;

  if (!thread)
    {
      PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
      return NULL;
    }

  return thread;
}