Cython: _abstract_linkable.py

Generated by Cython 3.0a5

Yellow lines hint at Python interaction.
Click on a line that starts with a "`+`" to see the C code that Cython generated for it.

Raw output: _abstract_linkable.c

    +001: # -*- coding: utf-8 -*-

        __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        {
          #if CYTHON_COMPILING_IN_LIMITED_API
          PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
          #endif
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }

     002: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False

     003: """

     004: Internal module, support for the linkable protocol for "event" like objects.

     005:

     006: """

     007: from __future__ import absolute_import

     008: from __future__ import division

     009: from __future__ import print_function

     010:

    +011: import sys

        __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        {
          #if CYTHON_COMPILING_IN_LIMITED_API
          PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 11, __pyx_L1_error)
          #endif
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }

     012:

    +013: from gevent._hub_local import get_hub_noargs as get_hub

        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_n_s_get_hub_noargs);
        __Pyx_GIVEREF(__pyx_n_s_get_hub_noargs);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_hub_noargs);
        __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__hub_local, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_hub_noargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        {
          #if CYTHON_COMPILING_IN_LIMITED_API
          PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 13, __pyx_L1_error)
          #endif
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hub_noargs, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +014: from gevent._hub_local import get_hub_if_exists

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_get_hub_if_exists);
        __Pyx_GIVEREF(__pyx_n_s_get_hub_if_exists);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_hub_if_exists);
        __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__hub_local, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_get_hub_if_exists); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        {
          #if CYTHON_COMPILING_IN_LIMITED_API
          PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 14, __pyx_L1_error)
          #endif
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hub_if_exists, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     015:

    +016: from gevent.exceptions import InvalidSwitchError

        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_n_s_InvalidSwitchError);
        __Pyx_GIVEREF(__pyx_n_s_InvalidSwitchError);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_InvalidSwitchError);
        __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent_exceptions, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_v_6gevent_27_gevent_c_abstract_linkable_InvalidSwitchError);
        __Pyx_DECREF_SET(__pyx_v_6gevent_27_gevent_c_abstract_linkable_InvalidSwitchError, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +017: from gevent.timeout import Timeout

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_Timeout);
        __Pyx_GIVEREF(__pyx_n_s_Timeout);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Timeout);
        __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent_timeout, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_v_6gevent_27_gevent_c_abstract_linkable_Timeout);
        __Pyx_DECREF_SET(__pyx_v_6gevent_27_gevent_c_abstract_linkable_Timeout, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     018:

    +019: locals()['getcurrent'] = __import__('greenlet').getcurrent

        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_getcurrent, __pyx_t_2) < 0)) __PYX_ERR(0, 19, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__4);
      __Pyx_GIVEREF(__pyx_tuple__4);

    +020: locals()['greenlet_init'] = lambda: None

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_lambda, METH_NOARGS, 0};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
      __pyx_r = __pyx_lambda_funcdef_6gevent_27_gevent_c_abstract_linkable_lambda(__pyx_self);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_lambda_funcdef_6gevent_27_gevent_c_abstract_linkable_lambda(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lambda", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* function exit code */
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 20, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, NULL); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_greenlet_init, __pyx_t_2) < 0)) __PYX_ERR(0, 20, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     021:

    +022: __all__ = [

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_AbstractLinkable);
        __Pyx_GIVEREF(__pyx_n_s_AbstractLinkable);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_AbstractLinkable);
        {
          #if CYTHON_COMPILING_IN_LIMITED_API
          PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 22, __pyx_L1_error)
          #endif
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }

     023:     'AbstractLinkable',

     024: ]

     025:

    +026: class AbstractLinkable(object):

    struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable {
      PyObject *(*linkcount)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, int __pyx_skip_dispatch);
      PyObject *(*rawlink)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *, int __pyx_skip_dispatch);
      int (*ready)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, int __pyx_skip_dispatch);
      PyObject *(*unlink)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *, int __pyx_skip_dispatch);
      PyObject *(*_check_and_notify)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *);
      void (*_capture_hub)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, int);
      PyObject *(*_AbstractLinkable__wait_to_be_notified)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, int);
      void (*_AbstractLinkable__unlink_all)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *);
      PyObject *(*_notify_link_list)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *);
      PyObject *(*_notify_links)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *, int __pyx_skip_dispatch);
      PyObject *(*_drop_lock_for_switch_out)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, int __pyx_skip_dispatch);
      PyObject *(*_acquire_lock_for_switch_in)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, int __pyx_skip_dispatch);
      PyObject *(*_wait_core)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *, struct __pyx_opt_args_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait_core *__pyx_optional_args);
      PyObject *(*_wait_return_value)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, PyObject *, PyObject *);
      PyObject *(*_wait)(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *, struct __pyx_opt_args_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait *__pyx_optional_args);
    };
    static struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_vtabptr_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable;

     027:     # Encapsulates the standard parts of the linking and notifying

     028:     # protocol common to both repeatable events (Event, Semaphore) and

     029:     # one-time events (AsyncResult).

     030:     #

     031:     # With a few careful exceptions, instances of this object can only

     032:     # be used from a single thread. The exception is that certain methods

     033:     # may be used from multiple threads IFF:

     034:     #

     035:     # 1.  They are documented as safe for that purpose; AND

     036:     # 2a. This object is compiled with Cython and thus is holding the GIL

     037:     #     for the entire duration of the method; OR

     038:     # 2b. A subclass ensures that a Python-level native thread lock is held

     039:     #     for the duration of the method; this is necessary in pure-Python mode.

     040:     #     The only known implementation of such

     041:     #     a subclass is for Semaphore.

     042:     #

     043:     # TODO: As of gevent 1.5, we use the same datastructures and almost

     044:     # the same algorithm as Greenlet. See about unifying them more.

     045:

     046:     __slots__ = (

    +047:         'hub',

        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_slots, __pyx_tuple__5) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
    /* … */
      __pyx_tuple__5 = PyTuple_Pack(5, __pyx_n_s_hub, __pyx_n_s_links, __pyx_n_s_notifier, __pyx_n_s_notify_all, __pyx_n_s_weakref); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__5);
      __Pyx_GIVEREF(__pyx_tuple__5);

     048:         '_links',

     049:         '_notifier',

     050:         '_notify_all',

     051:         '__weakref__'

     052:     )

     053:

    +054:     def __init__(self, hub=None):

    /* Python wrapper */
    static int __pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_hub = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hub,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hub,0};
        #endif
        PyObject* values[1] = {0};
        values[0] = ((PyObject *)Py_None);
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (kw_args > 0) {
              PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hub);
              if (value) { values[0] = value; kw_args--; }
              else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 54, __pyx_L3_error)
          }
        } else {
          switch (__pyx_nargs) {
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_hub = values[0];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 54, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable___init__(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), __pyx_v_hub);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable___init__(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_hub) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     055:         # Before this implementation, AsyncResult and Semaphore

     056:         # maintained the order of notifications, but Event did not.

     057:

     058:         # In gevent 1.3, before Semaphore extended this class, that

     059:         # was changed to not maintain the order. It was done because

     060:         # Event guaranteed to only call callbacks once (a set) but

     061:         # AsyncResult had no such guarantees. When Semaphore was

     062:         # changed to extend this class, it lost its ordering

     063:         # guarantees. Unfortunately, that made it unfair. There are

     064:         # rare cases that this can starve a greenlet

     065:         # (https://github.com/gevent/gevent/issues/1487) and maybe

     066:         # even lead to deadlock (not tested).

     067:

     068:         # So in gevent 1.5 we go back to maintaining order. But it's

     069:         # still important not to make duplicate calls, and it's also

     070:         # important to avoid O(n^2) behaviour that can result from

     071:         # naive use of a simple list due to the need to handle removed

     072:         # links in the _notify_links loop. Cython has special support for

     073:         # built-in sets, lists, and dicts, but not ordereddict. Rather than

     074:         # use two data structures, or a dict({link: order}), we simply use a

     075:         # list and remove objects as we go, keeping track of them so as not to

     076:         # have duplicates called. This makes `unlink` O(n), but we can avoid

     077:         # calling it in the common case in _wait_core (even so, the number of

     078:         # waiters should usually be pretty small)

    +079:         self._links = []

      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_links);
      __Pyx_DECREF(__pyx_v_self->_links);
      __pyx_v_self->_links = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +080:         self._notifier = None

      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_notifier);
      __Pyx_DECREF(__pyx_v_self->_notifier);
      __pyx_v_self->_notifier = Py_None;

     081:         # This is conceptually a class attribute, defined here for ease of access in

     082:         # cython. If it's true, when notifiers fire, all existing callbacks are called.

     083:         # If its false, we only call callbacks as long as ready() returns true.

    +084:         self._notify_all = True

      __pyx_v_self->_notify_all = 1;

     085:         # we don't want to do get_hub() here to allow defining module-level objects

     086:         # without initializing the hub. However, for multiple-thread safety, as soon

     087:         # as a waiting method is entered, even if it won't have to wait, we

     088:         # need to grab the hub and assign ownership. For that reason, if the hub

     089:         # is present, we'll go ahead and take it.

    +090:         self.hub = hub if hub is not None else get_hub_if_exists()

      __pyx_t_2 = (__pyx_v_hub != Py_None);
      if ((__pyx_t_2 != 0)) {
        if (!(likely(((__pyx_v_hub) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_hub, __pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop))))) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_INCREF(__pyx_v_hub);
        __pyx_t_1 = __pyx_v_hub;
      } else {
        __pyx_t_3 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_if_exists(0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->hub);
      __Pyx_DECREF((PyObject *)__pyx_v_self->hub);
      __pyx_v_self->hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

     091:

    +092:     def linkcount(self):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_linkcount(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("linkcount", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_linkcount); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount)) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_4, };
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.linkcount", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_2linkcount, "AbstractLinkable.linkcount(self)");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount = {"linkcount", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount, METH_NOARGS, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_2linkcount};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("linkcount (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_2linkcount(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_2linkcount(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("linkcount", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_linkcount(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.linkcount", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__6);
      __Pyx_GIVEREF(__pyx_tuple__6);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 92, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_3linkcount, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_linkcount, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__7)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_linkcount, __pyx_t_2) < 0) __PYX_ERR(0, 92, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
      __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_linkcount, 92, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 92, __pyx_L1_error)

     093:         # For testing: how many objects are linked to this one?

    +094:         return len(self._links)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_v_self->_links;
      __Pyx_INCREF(__pyx_t_1);
      if (unlikely(__pyx_t_1 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 94, __pyx_L1_error)
      }
      __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 94, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     095:

    +096:     def ready(self):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static int __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_ready(CYTHON_UNUSED struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_skip_dispatch) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ready", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ready); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready)) {
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_4, };
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_r = __pyx_t_6;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_WriteUnraisable("gevent._gevent_c_abstract_linkable.AbstractLinkable.ready", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_4ready, "AbstractLinkable.ready(self) -> bool");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready = {"ready", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready, METH_NOARGS, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_4ready};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ready (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_4ready(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_4ready(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ready", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_ready(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.ready", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__8);
      __Pyx_GIVEREF(__pyx_tuple__8);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 96, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_5ready, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_ready, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__9)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_ready, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
      __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_ready, 96, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 96, __pyx_L1_error)

     097:         # Instances must define this

    +098:         raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(0, 98, __pyx_L1_error)

     099:

    +100:     def rawlink(self, callback):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_rawlink(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rawlink", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rawlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink)) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_callback};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_6rawlink, "AbstractLinkable.rawlink(self, callback)\n\n        Register a callback to call when this object is ready.\n\n        *callback* will be called in the :class:`Hub\n        <gevent.hub.Hub>`, so it must not use blocking gevent API.\n        *callback* will be passed one argument: this instance.\n        ");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink = {"rawlink", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink, METH_O, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_6rawlink};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rawlink (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_6rawlink(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), ((PyObject *)__pyx_v_callback));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_6rawlink(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rawlink", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_rawlink(__pyx_v_self, __pyx_v_callback, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__10);
      __Pyx_GIVEREF(__pyx_tuple__10);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 100, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_7rawlink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_rawlink, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__11)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_rawlink, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
      __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_rawlink, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 100, __pyx_L1_error)

     101:         """

     102:         Register a callback to call when this object is ready.

     103:

     104:         *callback* will be called in the :class:`Hub

     105:         <gevent.hub.Hub>`, so it must not use blocking gevent API.

     106:         *callback* will be passed one argument: this instance.

     107:         """

    +108:         if not callable(callback):

      __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_v_callback); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 108, __pyx_L1_error)
      __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0);
      if (unlikely(__pyx_t_7)) {
    /* … */
      }

    +109:             raise TypeError('Expected callable: %r' % (callback, ))

        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_callback);
        __Pyx_GIVEREF(__pyx_v_callback);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_callback);
        __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Expected_callable_r, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 109, __pyx_L1_error)

    +110:         self._links.append(callback)

      if (unlikely(__pyx_v_self->_links == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(0, 110, __pyx_L1_error)
      }
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->_links, __pyx_v_callback); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 110, __pyx_L1_error)

    +111:         self._check_and_notify()

      __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_check_and_notify(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     112:

    +113:     def unlink(self, callback):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_unlink(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("unlink", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink)) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_callback};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_8unlink, "AbstractLinkable.unlink(self, callback)\nRemove the callback set by :meth:`rawlink`");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink = {"unlink", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink, METH_O, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_8unlink};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("unlink (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_8unlink(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), ((PyObject *)__pyx_v_callback));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_8unlink(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("unlink", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_unlink(__pyx_v_self, __pyx_v_callback, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 113, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_9unlink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_unlink, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__13)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_unlink, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
      __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_unlink, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 113, __pyx_L1_error)

     114:         """Remove the callback set by :meth:`rawlink`"""

    +115:         try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L4_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L8_try_end:;
      }

    +116:             self._links.remove(callback)

          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_links, __pyx_n_s_remove); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = NULL;
          __pyx_t_5 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
              __pyx_t_5 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_callback};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +117:         except ValueError:

        __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_5) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L4_exception_handled;
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;

     118:             pass

     119:

    +120:         if not self._links and self._notifier is not None and self._notifier.pending:

      __pyx_t_10 = (__pyx_v_self->_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_links) != 0);
      __pyx_t_11 = ((!__pyx_t_10) != 0);
      if (__pyx_t_11) {
      } else {
        __pyx_t_9 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_11 = (__pyx_v_self->_notifier != Py_None);
      __pyx_t_10 = (__pyx_t_11 != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_9 = __pyx_t_10;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_pending); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 120, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __pyx_t_10;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_9) {
    /* … */
      }

     121:             # If we currently have one queued, but not running, de-queue it.

     122:             # This will break a reference cycle.

     123:             # (self._notifier -> self._notify_links -> self)

     124:             # If it's actually running, though, (and we're here as a result of callbacks)

     125:             # we don't want to change it; it needs to finish what its doing

     126:             # so we don't attempt to start a fresh one or swap it out from underneath the

     127:             # _notify_links method.

    +128:             self._notifier.stop()

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_5 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[1] = {__pyx_t_3, };
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     129:

    +130:     def _capture_hub(self, create):

    static void __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__capture_hub(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_v_create) {
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_current_hub = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_capture_hub", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_WriteUnraisable("gevent._gevent_c_abstract_linkable.AbstractLinkable._capture_hub", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_current_hub);
      __Pyx_RefNannyFinishContext();
    }

     131:         # Subclasses should call this as the first action from any

     132:         # public method that could, in theory, block and switch

     133:         # to the hub. This may release the GIL.

    +134:         if self.hub is None:

      __pyx_t_1 = (((PyObject *)__pyx_v_self->hub) == Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {
    /* … */
      }

     135:             # This next line might release the GIL.

    +136:             current_hub = get_hub() if create else get_hub_if_exists()

        if ((__pyx_v_create != 0)) {
          __pyx_t_4 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = __pyx_t_4;
          __pyx_t_4 = 0;
        } else {
          __pyx_t_4 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_if_exists(0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = __pyx_t_4;
          __pyx_t_4 = 0;
        }
        __pyx_v_current_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3);
        __pyx_t_3 = 0;

    +137:             if current_hub is None:

        __pyx_t_2 = (((PyObject *)__pyx_v_current_hub) == Py_None);
        __pyx_t_1 = (__pyx_t_2 != 0);
        if (__pyx_t_1) {
    /* … */
        }

    +138:                 return

          goto __pyx_L0;

     139:             # We have the GIL again. Did anything change? If so,

     140:             # we lost the race.

    +141:             if self.hub is None:

        __pyx_t_1 = (((PyObject *)__pyx_v_self->hub) == Py_None);
        __pyx_t_2 = (__pyx_t_1 != 0);
        if (__pyx_t_2) {
    /* … */
        }

    +142:                 self.hub = current_hub

          __Pyx_INCREF((PyObject *)__pyx_v_current_hub);
          __Pyx_GIVEREF((PyObject *)__pyx_v_current_hub);
          __Pyx_GOTREF((PyObject *)__pyx_v_self->hub);
          __Pyx_DECREF((PyObject *)__pyx_v_self->hub);
          __pyx_v_self->hub = __pyx_v_current_hub;

     143:

    +144:     def _check_and_notify(self):

    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__check_and_notify(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_check_and_notify", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._check_and_notify", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     145:         # If this object is ready to be notified, begin the process.

    +146:         if self.ready() and self._links and not self._notifier:

      __pyx_t_2 = (((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_self->_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_links) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_notifier); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 146, __pyx_L1_error)
      __pyx_t_3 = ((!__pyx_t_2) != 0);
      __pyx_t_1 = __pyx_t_3;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_1) {
    /* … */
      }

    +147:             self._capture_hub(True) # Must create, we need it.

        ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_capture_hub(__pyx_v_self, 1);

    +148:             self._notifier = self.hub.loop.run_callback(self._notify_links, [])

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_9 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_v_self->_notifier);
        __Pyx_DECREF(__pyx_v_self->_notifier);
        __pyx_v_self->_notifier = __pyx_t_4;
        __pyx_t_4 = 0;

     149:

    +150:     def _notify_link_list(self, links):

    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__notify_link_list(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_links) {
      int __pyx_v_only_while_ready;
      PyObject *__pyx_v_final_link = NULL;
      PyObject *__pyx_v_done = NULL;
      PyObject *__pyx_v_link = NULL;
      PyObject *__pyx_v_id_link = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_notify_link_list", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_19);
      __Pyx_XDECREF(__pyx_t_20);
      __Pyx_XDECREF(__pyx_t_21);
      __Pyx_XDECREF(__pyx_t_22);
      __Pyx_XDECREF(__pyx_t_23);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._notify_link_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_final_link);
      __Pyx_XDECREF(__pyx_v_done);
      __Pyx_XDECREF(__pyx_v_link);
      __Pyx_XDECREF(__pyx_v_id_link);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     151:         # The core of the _notify_links method to notify

     152:         # links in order. Lets the ``links`` list be mutated,

     153:         # and only notifies up to the last item in the list, in case

     154:         # objects are added to it.

    +155:         only_while_ready = not self._notify_all

      __pyx_v_only_while_ready = (!(__pyx_v_self->_notify_all != 0));

    +156:         final_link = links[-1]

      if (unlikely(__pyx_v_links == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 156, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_links, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_final_link = __pyx_t_1;
      __pyx_t_1 = 0;

    +157:         done = set() # of ids

      __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_done = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +158:         while links: # remember this can be mutated

      while (1) {
        __pyx_t_2 = (__pyx_v_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_links) != 0);
        if (!__pyx_t_2) break;

    +159:             if only_while_ready and not self.ready():

        __pyx_t_3 = (__pyx_v_only_while_ready != 0);
        if (__pyx_t_3) {
        } else {
          __pyx_t_2 = __pyx_t_3;
          goto __pyx_L6_bool_binop_done;
        }
        __pyx_t_3 = ((!(((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0)) != 0);
        __pyx_t_2 = __pyx_t_3;
        __pyx_L6_bool_binop_done:;
        if (__pyx_t_2) {
    /* … */
        }

    +160:                 break

          goto __pyx_L4_break;

     161:

    +162:             link = links.pop(0) # Cython optimizes using list internals

        if (unlikely(__pyx_v_links == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
          __PYX_ERR(0, 162, __pyx_L1_error)
        }
        __pyx_t_1 = __Pyx_PyList_PopIndex(__pyx_v_links, __pyx_int_0, 0, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1);
        __pyx_t_1 = 0;

    +163:             id_link = id(link)

        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_link); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_id_link, __pyx_t_1);
        __pyx_t_1 = 0;

    +164:             if id_link not in done:

        __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_id_link, __pyx_v_done, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 164, __pyx_L1_error)
        __pyx_t_3 = (__pyx_t_2 != 0);
        if (__pyx_t_3) {
    /* … */
        }

     165:                 # XXX: JAM: What was I thinking? This doesn't make much sense,

     166:                 # there's a good chance `link` will be deallocated, and its id() will

     167:                 # be free to be reused.

    +168:                 done.add(id_link)

          __pyx_t_4 = PySet_Add(__pyx_v_done, __pyx_v_id_link); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 168, __pyx_L1_error)

    +169:                 try:

          {
            /*try:*/ {
    /* … */
            }
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L16_try_end;
            __pyx_L9_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    /* … */
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
            goto __pyx_L1_error;
            __pyx_L10_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
            __pyx_L16_try_end:;
          }

    +170:                     self._drop_lock_for_switch_out()

              __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_drop_lock_for_switch_out(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +171:                     try:

              /*try:*/ {

    +172:                         link(self)

                __Pyx_INCREF(__pyx_v_link);
                __pyx_t_8 = __pyx_v_link; __pyx_t_9 = NULL;
                __pyx_t_10 = 0;
                if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
                  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
                  if (likely(__pyx_t_9)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
                    __Pyx_INCREF(__pyx_t_9);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_8, function);
                    __pyx_t_10 = 1;
                  }
                }
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_9, ((PyObject *)__pyx_v_self)};
                  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
                  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L20_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                }
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              }

     173:                     finally:

    +174:                         self._acquire_lock_for_switch_in()

              /*finally:*/ {
                /*normal exit:*/{
                  __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_acquire_lock_for_switch_in(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  goto __pyx_L21;
                }
                __pyx_L20_error:;
                /*exception exit:*/{
                  __Pyx_PyThreadState_declare
                  __Pyx_PyThreadState_assign
                  __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
                  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
                  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                  if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
                  if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
                  __Pyx_XGOTREF(__pyx_t_13);
                  __Pyx_XGOTREF(__pyx_t_14);
                  __Pyx_XGOTREF(__pyx_t_15);
                  __Pyx_XGOTREF(__pyx_t_16);
                  __Pyx_XGOTREF(__pyx_t_17);
                  __Pyx_XGOTREF(__pyx_t_18);
                  __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
                  {
                    __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_acquire_lock_for_switch_in(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L25_error)
                    __Pyx_GOTREF(__pyx_t_1);
                    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  }
                  if (PY_MAJOR_VERSION >= 3) {
                    __Pyx_XGIVEREF(__pyx_t_16);
                    __Pyx_XGIVEREF(__pyx_t_17);
                    __Pyx_XGIVEREF(__pyx_t_18);
                    __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
                  }
                  __Pyx_XGIVEREF(__pyx_t_13);
                  __Pyx_XGIVEREF(__pyx_t_14);
                  __Pyx_XGIVEREF(__pyx_t_15);
                  __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
                  __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
                  __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
                  goto __pyx_L9_error;
                  __pyx_L25_error:;
                  if (PY_MAJOR_VERSION >= 3) {
                    __Pyx_XGIVEREF(__pyx_t_16);
                    __Pyx_XGIVEREF(__pyx_t_17);
                    __Pyx_XGIVEREF(__pyx_t_18);
                    __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
                  }
                  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
                  goto __pyx_L9_error;
                }
                __pyx_L21:;
              }

    +175:                 except: # pylint:disable=bare-except

            /*except:*/ {
              __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._notify_link_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 175, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_GOTREF(__pyx_t_9);

     176:                     # We're running in the hub, errors must not escape.

    +177:                     self.hub.handle_error((link, self), *sys.exc_info())

              __pyx_t_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->hub), __pyx_n_s_handle_error); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_19);
              __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_20);
              __Pyx_INCREF(__pyx_v_link);
              __Pyx_GIVEREF(__pyx_v_link);
              PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_link);
              __Pyx_INCREF((PyObject *)__pyx_v_self);
              __Pyx_GIVEREF((PyObject *)__pyx_v_self);
              PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_v_self));
              __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_21);
              __Pyx_GIVEREF(__pyx_t_20);
              PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_20);
              __pyx_t_20 = 0;
              __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_sys); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_22);
              __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_23);
              __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
              __pyx_t_22 = NULL;
              __pyx_t_11 = 0;
              if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
                __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_23);
                if (likely(__pyx_t_22)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
                  __Pyx_INCREF(__pyx_t_22);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_23, function);
                  __pyx_t_11 = 1;
                }
              }
              {
                PyObject *__pyx_callargs[1] = {__pyx_t_22, };
                __pyx_t_20 = __Pyx_PyObject_FastCall(__pyx_t_23, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11);
                __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
                if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 177, __pyx_L11_except_error)
                __Pyx_GOTREF(__pyx_t_20);
                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
              }
              __pyx_t_23 = __Pyx_PySequence_Tuple(__pyx_t_20); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_23);
              __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
              __pyx_t_20 = PyNumber_Add(__pyx_t_21, __pyx_t_23); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_20);
              __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
              __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
              __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_20, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 177, __pyx_L11_except_error)
              __Pyx_GOTREF(__pyx_t_23);
              __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
              __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
              __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
              goto __pyx_L10_exception_handled;
            }
            __pyx_L11_except_error:;

     178:

    +179:             if link is final_link:

        __pyx_t_3 = (__pyx_v_link == __pyx_v_final_link);
        __pyx_t_2 = (__pyx_t_3 != 0);
        if (__pyx_t_2) {
    /* … */
        }
      }
      __pyx_L4_break:;

    +180:                 break

          goto __pyx_L4_break;

     181:

    +182:     def _notify_links(self, arrived_while_waiting):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links(PyObject *__pyx_v_self, PyObject *__pyx_v_arrived_while_waiting); /*proto*/
    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__notify_links(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_arrived_while_waiting, int __pyx_skip_dispatch) {
      PyObject *__pyx_v_notifier = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_notify_links", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links)) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_arrived_while_waiting};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_notifier);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links(PyObject *__pyx_v_self, PyObject *__pyx_v_arrived_while_waiting); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_10_notify_links, "AbstractLinkable._notify_links(self, list arrived_while_waiting)");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links = {"_notify_links", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links, METH_O, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_10_notify_links};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links(PyObject *__pyx_v_self, PyObject *__pyx_v_arrived_while_waiting) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_notify_links (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arrived_while_waiting), (&PyList_Type), 1, "arrived_while_waiting", 1))) __PYX_ERR(0, 182, __pyx_L1_error)
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_10_notify_links(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), ((PyObject*)__pyx_v_arrived_while_waiting));
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_10_notify_links(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_arrived_while_waiting) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_notify_links", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__notify_links(__pyx_v_self, __pyx_v_arrived_while_waiting, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_arrived_while_waiting); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__14);
      __Pyx_GIVEREF(__pyx_tuple__14);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 182, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_11_notify_links, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable__notify_links, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__15)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_notify_links, __pyx_t_2) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
      __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_notify_links, 182, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 182, __pyx_L1_error)

     183:         # This method must hold the GIL, or be guarded with the lock that guards

     184:         # this object. Thus, while we are notifying objects, an object from another

     185:         # thread simply cannot arrive and mutate ``_links`` or ``arrived_while_waiting``

     186:

     187:         # ``arrived_while_waiting`` is a list of greenlet.switch methods

     188:         # to call. These were objects that called wait() while we were processing,

     189:         # and which would have run *before* those that had actually waited

     190:         # and blocked. Instead of returning True immediately, we add them to this

     191:         # list so they wait their turn.

     192:

     193:         # We release self._notifier here when done invoking links.

     194:         # The object itself becomes false in a boolean way as soon

     195:         # as this method returns.

    +196:         notifier = self._notifier

      __pyx_t_1 = __pyx_v_self->_notifier;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_notifier = __pyx_t_1;
      __pyx_t_1 = 0;

     197:         # Early links are allowed to remove later links, and links

     198:         # are allowed to add more links, thus we must not

     199:         # make a copy of our the ``_links`` list, we must traverse it and

     200:         # mutate in place.

     201:         #

     202:         # We were ready() at the time this callback was scheduled; we

     203:         # may not be anymore, and that status may change during

     204:         # callback processing. Some of our subclasses (Event) will

     205:         # want to notify everyone who was registered when the status

     206:         # became true that it was once true, even though it may not be

     207:         # any more. In that case, we must not keep notifying anyone that's

     208:         # newly added after that, even if we go ready again.

    +209:         try:

      /*try:*/ {

    +210:             self._notify_link_list(self._links)

        __pyx_t_1 = __pyx_v_self->_links;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_notify_link_list(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     211:             # Now, those that arrived after we had begun the notification

     212:             # process. Follow the same rules, stop with those that are

     213:             # added so far to prevent starvation.

    +214:             if arrived_while_waiting:

        __pyx_t_6 = (__pyx_v_arrived_while_waiting != Py_None)&&(PyList_GET_SIZE(__pyx_v_arrived_while_waiting) != 0);
        if (__pyx_t_6) {
    /* … */
        }
      }

    +215:                 self._notify_link_list(arrived_while_waiting)

          __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_notify_link_list(__pyx_v_self, __pyx_v_arrived_while_waiting); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     216:

     217:                 # Anything left needs to go back on the main list.

    +218:                 self._links.extend(arrived_while_waiting)

          if (unlikely(__pyx_v_self->_links == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend");
            __PYX_ERR(0, 218, __pyx_L4_error)
          }
          __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_self->_links, __pyx_v_arrived_while_waiting); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 218, __pyx_L4_error)

     219:         finally:

     220:             # We should not have created a new notifier even if callbacks

     221:             # released us because we loop through *all* of our links on the

     222:             # same callback while self._notifier is still true.

    +223:             assert self._notifier is notifier

      /*finally:*/ {
        /*normal exit:*/{
          #ifndef CYTHON_WITHOUT_ASSERTIONS
          if (unlikely(!Py_OptimizeFlag)) {
            __pyx_t_6 = (__pyx_v_self->_notifier == __pyx_v_notifier);
            __pyx_t_8 = (__pyx_t_6 != 0);
            if (unlikely(!__pyx_t_8)) {
              __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
              __PYX_ERR(0, 223, __pyx_L1_error)
            }
          }
          #else
          if ((1)); else __PYX_ERR(0, 223, __pyx_L1_error)
          #endif
    /* … */
            #ifndef CYTHON_WITHOUT_ASSERTIONS
            if (unlikely(!Py_OptimizeFlag)) {
              __pyx_t_8 = (__pyx_v_self->_notifier == __pyx_v_notifier);
              __pyx_t_6 = (__pyx_t_8 != 0);
              if (unlikely(!__pyx_t_6)) {
                __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
                __PYX_ERR(0, 223, __pyx_L8_error)
              }
            }
            #else
            if ((1)); else __PYX_ERR(0, 223, __pyx_L8_error)
            #endif

    +224:             self._notifier = None

          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          __Pyx_GOTREF(__pyx_v_self->_notifier);
          __Pyx_DECREF(__pyx_v_self->_notifier);
          __pyx_v_self->_notifier = Py_None;
          goto __pyx_L5;
        }
        __pyx_L4_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __pyx_t_5 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
          {
    /* … */
            __Pyx_INCREF(Py_None);
            __Pyx_GIVEREF(Py_None);
            __Pyx_GOTREF(__pyx_v_self->_notifier);
            __Pyx_DECREF(__pyx_v_self->_notifier);
            __pyx_v_self->_notifier = Py_None;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
          goto __pyx_L1_error;
          __pyx_L8_error:;
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }

     225:             # TODO: Maybe we should intelligently reset self.hub to

     226:             # free up thread affinity? In case of a pathological situation where

     227:             # one object was used from one thread once & first,  but usually is

     228:             # used by another thread.

     229:         # Now we may be ready or not ready. If we're ready, which

     230:         # could have happened during the last link we called, then we

     231:         # must have more links than we started with. We need to schedule the

     232:         # wakeup.

    +233:         self._check_and_notify()

      __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_check_and_notify(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     234:

    +235:     def __unlink_all(self, obj):

    static void __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__AbstractLinkable__unlink_all(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_obj) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_AbstractLinkable__unlink_all", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_WriteUnraisable("gevent._gevent_c_abstract_linkable.AbstractLinkable._AbstractLinkable__unlink_all", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    +236:         if obj is None:

      __pyx_t_1 = (__pyx_v_obj == Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +237:             return

        goto __pyx_L0;

     238:

    +239:         self.unlink(obj)

      __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->unlink(__pyx_v_self, __pyx_v_obj, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +240:         if self._notifier is not None and self._notifier.args:

      __pyx_t_1 = (__pyx_v_self->_notifier != Py_None);
      __pyx_t_4 = (__pyx_t_1 != 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_2 = __pyx_t_4;
        goto __pyx_L5_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_L5_bool_binop_done:;
      if (__pyx_t_2) {
    /* … */
      }

    +241:             try:

        {
          /*try:*/ {
    /* … */
          }
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L12_try_end;
          __pyx_L7_error:;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    /* … */
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
          goto __pyx_L1_error;
          __pyx_L8_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
          __pyx_L12_try_end:;
        }

    +242:                 self._notifier.args[0].remove(obj)

            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_args); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 242, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 242, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_remove); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 242, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_9 = NULL;
            __pyx_t_10 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
              __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
              if (likely(__pyx_t_9)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
                __Pyx_INCREF(__pyx_t_9);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_8, function);
                __pyx_t_10 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_obj};
              __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +243:             except ValueError:

          __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
          if (__pyx_t_10) {
            __Pyx_ErrRestore(0,0,0);
            goto __pyx_L8_exception_handled;
          }
          goto __pyx_L9_except_error;
          __pyx_L9_except_error:;

     244:                 pass

     245:

    +246:     def __wait_to_be_notified(self, rawlink): # pylint:disable=too-many-branches

    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__AbstractLinkable__wait_to_be_notified(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_v_rawlink) {
      PyObject *__pyx_v_resume_this_greenlet = NULL;
      PyObject *__pyx_v_watcher = NULL;
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_current_hub = NULL;
      PyObject *__pyx_v_send = NULL;
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_my_hub = NULL;
      PyObject *__pyx_v_result = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_AbstractLinkable__wait_to_be_notified", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._AbstractLinkable__wait_to_be_notified", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_resume_this_greenlet);
      __Pyx_XDECREF(__pyx_v_watcher);
      __Pyx_XDECREF((PyObject *)__pyx_v_current_hub);
      __Pyx_XDECREF(__pyx_v_send);
      __Pyx_XDECREF((PyObject *)__pyx_v_my_hub);
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     247:         # We've got to watch where we could potentially release the GIL.

     248:         # Decisions we make based an the state of this object must be in blocks

     249:         # that cannot release the GIL.

    +250:         resume_this_greenlet = None

      __Pyx_INCREF(Py_None);
      __pyx_v_resume_this_greenlet = Py_None;

    +251:         watcher = None

      __Pyx_INCREF(Py_None);
      __pyx_v_watcher = Py_None;

    +252:         current_hub = get_hub()

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_current_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

    +253:         send = None

      __Pyx_INCREF(Py_None);
      __pyx_v_send = Py_None;

     254:

    +255:         while 1:

      while (1) {

    +256:             my_hub = self.hub

        __pyx_t_1 = ((PyObject *)__pyx_v_self->hub);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_my_hub, ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1));
        __pyx_t_1 = 0;

    +257:             if my_hub is current_hub:

        __pyx_t_2 = (__pyx_v_my_hub == __pyx_v_current_hub);
        __pyx_t_3 = (__pyx_t_2 != 0);
        if (__pyx_t_3) {
    /* … */
        }

    +258:                 break

          goto __pyx_L4_break;

     259:

     260:             # We're owned by another hub.

    +261:             if my_hub.dead: # dead is a property, this could have released the GIL.

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_my_hub), __pyx_n_s_dead); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 261, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_3) {
    /* … */
        }

     262:                 # We have the GIL back. Did anything change?

    +263:                 if my_hub is not self.hub:

          __pyx_t_3 = (__pyx_v_my_hub != __pyx_v_self->hub);
          __pyx_t_2 = (__pyx_t_3 != 0);
          if (__pyx_t_2) {
    /* … */
          }

    +264:                     continue # start over.

            goto __pyx_L3_continue;

     265:                 # The other hub is dead, so we can take ownership.

    +266:                 self.hub = current_hub

          __Pyx_INCREF((PyObject *)__pyx_v_current_hub);
          __Pyx_GIVEREF((PyObject *)__pyx_v_current_hub);
          __Pyx_GOTREF((PyObject *)__pyx_v_self->hub);
          __Pyx_DECREF((PyObject *)__pyx_v_self->hub);
          __pyx_v_self->hub = __pyx_v_current_hub;

    +267:                 break

          goto __pyx_L4_break;

     268:             # Some other hub owns this object. We must ask it to wake us

     269:             # up. We can't use a Python-level ``Lock`` because

     270:             # (1) it doesn't support a timeout on all platforms; and

     271:             # (2) we don't want to block this hub from running. So we need to

     272:             # do so in a way that cooperates with *two* hubs. That's what an

     273:             # async watcher is built for.

     274:             #

     275:             # Allocating and starting the watcher *could* release the GIL.

     276:             # with the libev corcext, allocating won't, but starting briefly will.

     277:             # With other backends, allocating might, and starting might also.

     278:             # So...XXX: Race condition here, tiny though it may be.

    +279:             watcher = current_hub.loop.async_()

        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_current_hub->loop, __pyx_n_s_async); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[1] = {__pyx_t_5, };
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_watcher, __pyx_t_1);
        __pyx_t_1 = 0;

    +280:             send = watcher.send_ignoring_arg

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s_send_ignoring_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF_SET(__pyx_v_send, __pyx_t_1);
        __pyx_t_1 = 0;

    +281:             if rawlink:

        __pyx_t_2 = (__pyx_v_rawlink != 0);
        if (__pyx_t_2) {
    /* … */
          goto __pyx_L8;
        }

     282:                 # Make direct calls to self.rawlink, the most common case,

     283:                 # so cython can more easily optimize.

    +284:                 self.rawlink(send)

          __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->rawlink(__pyx_v_self, __pyx_v_send, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     285:             else:

    +286:                 self._notifier.args[0].append(send)

        /*else*/ {
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_v_send); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 286, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L8:;

     287:

    +288:             watcher.start(getcurrent().switch, self) # pylint:disable=undefined-variable

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = ((PyObject *)__pyx_f_6gevent_27_gevent_c_abstract_linkable_getcurrent()); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_switch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_6 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_8, ((PyObject *)__pyx_v_self)};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +289:             break

        goto __pyx_L4_break;
        __pyx_L3_continue:;
      }
      __pyx_L4_break:;

     290:

    +291:         if self.hub is current_hub:

      __pyx_t_2 = (__pyx_v_self->hub == __pyx_v_current_hub);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
      }

    +292:             resume_this_greenlet = getcurrent().switch # pylint:disable=undefined-variable

        __pyx_t_4 = ((PyObject *)__pyx_f_6gevent_27_gevent_c_abstract_linkable_getcurrent()); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_switch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_resume_this_greenlet, __pyx_t_1);
        __pyx_t_1 = 0;

    +293:             if rawlink:

        __pyx_t_3 = (__pyx_v_rawlink != 0);
        if (__pyx_t_3) {
    /* … */
          goto __pyx_L10;
        }

    +294:                 self.rawlink(resume_this_greenlet)

          __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->rawlink(__pyx_v_self, __pyx_v_resume_this_greenlet, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     295:             else:

    +296:                 self._notifier.args[0].append(resume_this_greenlet)

        /*else*/ {
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_v_resume_this_greenlet); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 296, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L10:;

    +297:         try:

      /*try:*/ {

    +298:             self._drop_lock_for_switch_out()

        __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_drop_lock_for_switch_out(__pyx_v_self, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +299:             result = current_hub.switch() # Probably releases

        __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_v_current_hub->__pyx_vtab)->__pyx_switch(__pyx_v_current_hub, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_result = __pyx_t_4;
        __pyx_t_4 = 0;

     300:             # If we got here, we were automatically unlinked already.

    +301:             resume_this_greenlet = None

        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_resume_this_greenlet, Py_None);

    +302:             if result is not self: # pragma: no cover

        __pyx_t_3 = (__pyx_v_result != ((PyObject *)__pyx_v_self));
        __pyx_t_2 = (__pyx_t_3 != 0);
        if (unlikely(__pyx_t_2)) {
    /* … */
        }
      }

     303:                 raise InvalidSwitchError(

    +304:                     'Invalid switch into %s.wait(): %r' % (

          __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_s_wait_r, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_INCREF(__pyx_v_6gevent_27_gevent_c_abstract_linkable_InvalidSwitchError);
          __pyx_t_1 = __pyx_v_6gevent_27_gevent_c_abstract_linkable_InvalidSwitchError; __pyx_t_5 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
              __pyx_t_6 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8};
            __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_Raise(__pyx_t_4, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __PYX_ERR(0, 303, __pyx_L12_error)

    +305:                         self.__class__.__name__,

          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 305, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /* … */
          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
          __Pyx_INCREF(__pyx_v_result);
          __Pyx_GIVEREF(__pyx_v_result);
          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_result);
          __pyx_t_8 = 0;

     306:                         result,

     307:                     )

     308:                 )

     309:         finally:

    +310:             self._acquire_lock_for_switch_in()

      /*finally:*/ {
        /*normal exit:*/{
          __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_acquire_lock_for_switch_in(__pyx_v_self, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* … */
            __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_acquire_lock_for_switch_in(__pyx_v_self, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +311:             self.__unlink_all(resume_this_greenlet)

          ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_AbstractLinkable__unlink_all(__pyx_v_self, __pyx_v_resume_this_greenlet);
    /* … */
            ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_AbstractLinkable__unlink_all(__pyx_v_self, __pyx_v_resume_this_greenlet);

    +312:             self.__unlink_all(send)

          ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_AbstractLinkable__unlink_all(__pyx_v_self, __pyx_v_send);
    /* … */
            ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_AbstractLinkable__unlink_all(__pyx_v_self, __pyx_v_send);

    +313:             if watcher is not None:

          __pyx_t_2 = (__pyx_v_watcher != Py_None);
          __pyx_t_3 = (__pyx_t_2 != 0);
          if (__pyx_t_3) {
    /* … */
          }
          goto __pyx_L13;
        }
        __pyx_L12_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __pyx_t_6 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
          {
    /* … */
            __pyx_t_3 = (__pyx_v_watcher != Py_None);
            __pyx_t_2 = (__pyx_t_3 != 0);
            if (__pyx_t_2) {
    /* … */
            }
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
          goto __pyx_L1_error;
          __pyx_L17_error:;
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L13:;
      }

    +314:                 watcher.stop()

            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_8 = NULL;
            __pyx_t_6 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_8)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_8);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
                __pyx_t_6 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_8, };
              __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* … */
              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L17_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_8 = NULL;
              __pyx_t_17 = 0;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_1, function);
                  __pyx_t_17 = 1;
                }
              }
              {
                PyObject *__pyx_callargs[1] = {__pyx_t_8, };
                __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_17, 0+__pyx_t_17);
                __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L17_error)
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              }
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +315:                 watcher.close()

            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_8 = NULL;
            __pyx_t_6 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_8)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_8);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
                __pyx_t_6 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_8, };
              __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* … */
              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L17_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_8 = NULL;
              __pyx_t_17 = 0;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_1, function);
                  __pyx_t_17 = 1;
                }
              }
              {
                PyObject *__pyx_callargs[1] = {__pyx_t_8, };
                __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_17, 0+__pyx_t_17);
                __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L17_error)
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              }
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     316:

    +317:     def _acquire_lock_for_switch_in(self):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__acquire_lock_for_switch_in(CYTHON_UNUSED struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_acquire_lock_for_switch_in", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_acquire_lock_for_switch_in); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in)) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_4, };
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._acquire_lock_for_switch_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_12_acquire_lock_for_switch_in, "AbstractLinkable._acquire_lock_for_switch_in(self)");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in = {"_acquire_lock_for_switch_in", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in, METH_NOARGS, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_12_acquire_lock_for_switch_in};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_acquire_lock_for_switch_in (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_12_acquire_lock_for_switch_in(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_12_acquire_lock_for_switch_in(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_acquire_lock_for_switch_in", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__acquire_lock_for_switch_in(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._acquire_lock_for_switch_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__16);
      __Pyx_GIVEREF(__pyx_tuple__16);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 317, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_13_acquire_lock_for_switch_in, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable__acquire_lock_f, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__17)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_acquire_lock_for_switch_in, __pyx_t_2) < 0) __PYX_ERR(0, 317, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);
      __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_acquire_lock_for_switch_in, 317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 317, __pyx_L1_error)

    +318:         return

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     319:

    +320:     def _drop_lock_for_switch_out(self):

    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__drop_lock_for_switch_out(CYTHON_UNUSED struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_drop_lock_for_switch_out", 0);
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_drop_lock_for_switch_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out)) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_4, };
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._drop_lock_for_switch_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_14_drop_lock_for_switch_out, "AbstractLinkable._drop_lock_for_switch_out(self)");
    static PyMethodDef __pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out = {"_drop_lock_for_switch_out", (PyCFunction)__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out, METH_NOARGS, __pyx_doc_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_14_drop_lock_for_switch_out};
    static PyObject *__pyx_pw_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_drop_lock_for_switch_out (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_14_drop_lock_for_switch_out(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_14_drop_lock_for_switch_out(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_drop_lock_for_switch_out", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__drop_lock_for_switch_out(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._drop_lock_for_switch_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__18);
      __Pyx_GIVEREF(__pyx_tuple__18);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
        #else
        __pyx_t_3 = __pyx_d;  if ((1)); else __PYX_ERR(0, 320, __pyx_L1_error);
        #endif
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable_15_drop_lock_for_switch_out, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable__drop_lock_for, NULL, __pyx_n_s_gevent__gevent_c_abstract_linkab, __pyx_t_3, ((PyObject *)__pyx_codeobj__19)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_drop_lock_for_switch_out, __pyx_t_2) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable);

    +321:         return

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     322:

    +323:     def _wait_core(self, timeout, catch=Timeout):

    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait_core(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_timeout, struct __pyx_opt_args_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait_core *__pyx_optional_args) {
      PyObject *__pyx_v_catch = __pyx_k_;
      PyObject *__pyx_v_timer = NULL;
      PyObject *__pyx_v_ex = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_wait_core", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_catch = __pyx_optional_args->catch;
        }
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._wait_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_timer);
      __Pyx_XDECREF(__pyx_v_ex);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
        __Pyx_INCREF(__pyx_v_6gevent_27_gevent_c_abstract_linkable_Timeout);
        __pyx_k_ = __pyx_v_6gevent_27_gevent_c_abstract_linkable_Timeout;
        __Pyx_GIVEREF(__pyx_v_6gevent_27_gevent_c_abstract_linkable_Timeout);

     324:         """

     325:         The core of the wait implementation, handling switching and

     326:         linking.

     327:

     328:         This method is safe to call from multiple threads; it must be holding

     329:         the GIL for the entire duration, or be protected by a Python-level

     330:         lock for that to be true.

     331:

     332:         ``self.hub`` must be initialized before entering this method.

     333:         The hub that is set is considered the owner and cannot be changed.

     334:

     335:         If *catch* is set to ``()``, a timeout that elapses will be

     336:         allowed to be raised.

     337:

     338:         :return: A true value if the wait succeeded without timing out.

     339:           That is, a true return value means we were notified and control

     340:           resumed in this greenlet.

     341:         """

    +342:         with Timeout._start_new_or_dummy(timeout) as timer: # Might release

      /*with:*/ {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_27_gevent_c_abstract_linkable_Timeout, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_4 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_timeout};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_4 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[1] = {__pyx_t_6, };
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_t_3 = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        /*try:*/ {
          {
            /*try:*/ {
              __pyx_v_timer = __pyx_t_3;
              __pyx_t_3 = 0;
    /* … */
            }
            __pyx_L7_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._wait_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 342, __pyx_L9_except_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_6 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L9_except_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L9_except_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (__pyx_t_14 < 0) __PYX_ERR(0, 342, __pyx_L9_except_error)
              __pyx_t_13 = ((!(__pyx_t_14 != 0)) != 0);
              if (unlikely(__pyx_t_13)) {
                __Pyx_GIVEREF(__pyx_t_2);
                __Pyx_GIVEREF(__pyx_t_1);
                __Pyx_XGIVEREF(__pyx_t_3);
                __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_3);
                __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
                __PYX_ERR(0, 342, __pyx_L9_except_error)
              }
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              goto __pyx_L8_exception_handled;
            }
            __pyx_L9_except_error:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            goto __pyx_L1_error;
            __pyx_L11_try_return:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            goto __pyx_L4_return;
            __pyx_L8_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_5) {
              __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__2, NULL);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 342, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            }
            goto __pyx_L6;
          }
          __pyx_L4_return: {
            __pyx_t_9 = __pyx_r;
            __pyx_r = 0;
            if (__pyx_t_5) {
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__2, NULL);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            __pyx_r = __pyx_t_9;
            __pyx_t_9 = 0;
            goto __pyx_L0;
          }
          __pyx_L6:;
        }
        goto __pyx_L34;
        __pyx_L3_error:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L1_error;
        __pyx_L34:;
      }
    /* … */
      __pyx_tuple__2 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__2);
      __Pyx_GIVEREF(__pyx_tuple__2);

    +343:             try:

              {
                /*try:*/ {
    /* … */
                }
                __pyx_L13_error:;
                __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    /* … */
                __Pyx_XGIVEREF(__pyx_t_10);
                __Pyx_XGIVEREF(__pyx_t_11);
                __Pyx_XGIVEREF(__pyx_t_12);
                __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
                goto __pyx_L7_error;
                __pyx_L17_try_return:;
                __Pyx_XGIVEREF(__pyx_t_10);
                __Pyx_XGIVEREF(__pyx_t_11);
                __Pyx_XGIVEREF(__pyx_t_12);
                __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
                goto __pyx_L11_try_return;
                __pyx_L16_except_return:;
                __Pyx_XGIVEREF(__pyx_t_10);
                __Pyx_XGIVEREF(__pyx_t_11);
                __Pyx_XGIVEREF(__pyx_t_12);
                __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
                goto __pyx_L11_try_return;
              }

    +344:                 self.__wait_to_be_notified(True) # Use rawlink()

                  __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_AbstractLinkable__wait_to_be_notified(__pyx_v_self, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L13_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +345:                 return True

                  __Pyx_XDECREF(__pyx_r);
                  __Pyx_INCREF(Py_True);
                  __pyx_r = Py_True;
                  goto __pyx_L17_try_return;

    +346:             except catch as ex:

                __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_v_catch);
                if (__pyx_t_4) {
                  __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._wait_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
                  if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 346, __pyx_L15_except_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_GOTREF(__pyx_t_2);
                  __Pyx_INCREF(__pyx_t_1);
                  __pyx_v_ex = __pyx_t_1;
                  /*try:*/ {
    /* … */
                  /*finally:*/ {
                    __pyx_L24_error:;
                    /*exception exit:*/{
                      __Pyx_PyThreadState_declare
                      __Pyx_PyThreadState_assign
                      __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
                      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
                      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
                      __Pyx_XGOTREF(__pyx_t_17);
                      __Pyx_XGOTREF(__pyx_t_18);
                      __Pyx_XGOTREF(__pyx_t_19);
                      __Pyx_XGOTREF(__pyx_t_20);
                      __Pyx_XGOTREF(__pyx_t_21);
                      __Pyx_XGOTREF(__pyx_t_22);
                      __pyx_t_4 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
                      {
                        __Pyx_DECREF(__pyx_v_ex); __pyx_v_ex = 0;
                      }
                      if (PY_MAJOR_VERSION >= 3) {
                        __Pyx_XGIVEREF(__pyx_t_20);
                        __Pyx_XGIVEREF(__pyx_t_21);
                        __Pyx_XGIVEREF(__pyx_t_22);
                        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                      }
                      __Pyx_XGIVEREF(__pyx_t_17);
                      __Pyx_XGIVEREF(__pyx_t_18);
                      __Pyx_XGIVEREF(__pyx_t_19);
                      __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
                      __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
                      goto __pyx_L15_except_error;
                    }
                    __pyx_L23_return: {
                      __pyx_t_22 = __pyx_r;
                      __pyx_r = 0;
                      __Pyx_DECREF(__pyx_v_ex); __pyx_v_ex = 0;
                      __pyx_r = __pyx_t_22;
                      __pyx_t_22 = 0;
                      goto __pyx_L16_except_return;
                    }
                  }
                }
                goto __pyx_L15_except_error;
                __pyx_L15_except_error:;

    +347:                 if ex is not timer:

                    __pyx_t_13 = (__pyx_v_ex != __pyx_v_timer);
                    __pyx_t_14 = (__pyx_t_13 != 0);
                    if (unlikely(__pyx_t_14)) {
    /* … */
                    }

    +348:                     raise

                      __Pyx_GIVEREF(__pyx_t_3);
                      __Pyx_GIVEREF(__pyx_t_1);
                      __Pyx_XGIVEREF(__pyx_t_2);
                      __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_2);
                      __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0;
                      __PYX_ERR(0, 348, __pyx_L24_error)

     349:                 # test_set_and_clear and test_timeout in test_threading

     350:                 # rely on the exact return values, not just truthish-ness

    +351:                 return False

                    __Pyx_XDECREF(__pyx_r);
                    __Pyx_INCREF(Py_False);
                    __pyx_r = Py_False;
                    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                    goto __pyx_L23_return;
                  }

     352:

    +353:     def _wait_return_value(self, waited, wait_success):

    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait_return_value(CYTHON_UNUSED struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_waited, CYTHON_UNUSED PyObject *__pyx_v_wait_success) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_wait_return_value", 0);
    /* … */
      /* function exit code */
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     354:         # pylint:disable=unused-argument

     355:         # Subclasses should override this to return a value from _wait.

     356:         # By default we return None.

    +357:         return None # pragma: no cover all extent subclasses override

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     358:

    +359:     def _wait(self, timeout=None):

    static PyObject *__pyx_f_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait(struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *__pyx_v_self, struct __pyx_opt_args_6gevent_27_gevent_c_abstract_linkable_16AbstractLinkable__wait *__pyx_optional_args) {
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_result = NULL;
      PyObject *__pyx_v_gotit = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_wait", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout = __pyx_optional_args->timeout;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("gevent._gevent_c_abstract_linkable.AbstractLinkable._wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_gotit);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     360:         """

     361:         This method is safe to call from multiple threads, providing

     362:         the conditions laid out in the class documentation are met.

     363:         """

     364:         # Watch where we could potentially release the GIL.

    +365:         self._capture_hub(True) # Must create, we must have an owner. Might release

      ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_capture_hub(__pyx_v_self, 1);

     366:

    +367:         if self.ready(): # *might* release, if overridden in Python.

      __pyx_t_1 = (((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +368:             result = self._wait_return_value(False, False) # pylint:disable=assignment-from-none

        __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_wait_return_value(__pyx_v_self, Py_False, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_result = __pyx_t_2;
        __pyx_t_2 = 0;

    +369:             if self._notifier:

        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_notifier); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 369, __pyx_L1_error)
        if (__pyx_t_1) {
    /* … */
        }

     370:                 # We're already notifying waiters; one of them must have run

     371:                 # and switched to this greenlet, which arrived here. Alternately,

     372:                 # we could be in a separate thread (but we're holding the GIL/object lock)

    +373:                 self.__wait_to_be_notified(False) # Use self._notifier.args[0] instead of self.rawlink

          __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_AbstractLinkable__wait_to_be_notified(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     374:

    +375:             return result

        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_result);
        __pyx_r = __pyx_v_result;
        goto __pyx_L0;

     376:

    +377:         gotit = self._wait_core(timeout)

      __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_wait_core(__pyx_v_self, __pyx_v_timeout, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_gotit = __pyx_t_2;
      __pyx_t_2 = 0;

    +378:         return self._wait_return_value(True, gotit)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_wait_return_value(__pyx_v_self, Py_True, __pyx_v_gotit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

     379:

    +380: def _init():

    static void __pyx_f_6gevent_27_gevent_c_abstract_linkable__init(void) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_init", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

    +381:     greenlet_init() # pylint:disable=undefined-variable

      __pyx_f_6gevent_27_gevent_c_abstract_linkable_greenlet_init();

     382:

    +383: _init()

        __pyx_f_6gevent_27_gevent_c_abstract_linkable__init();

     384:

     385:

    +386: from gevent._util import import_c_accel

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_import_c_accel);
        __Pyx_GIVEREF(__pyx_n_s_import_c_accel);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_import_c_accel);
        __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        {
          #if CYTHON_COMPILING_IN_LIMITED_API
          PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 386, __pyx_L1_error)
          #endif
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_2) < 0) __PYX_ERR(0, 386, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +387: import_c_accel(globals(), 'gevent.__abstract_linkable')

        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
        __Pyx_INCREF(__pyx_kp_s_gevent___abstract_linkable);
        __Pyx_GIVEREF(__pyx_kp_s_gevent___abstract_linkable);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_s_gevent___abstract_linkable);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;