Source

pypy / pypy / rlib / _stacklet_n_a.py

from pypy.rlib import _rffi_stacklet as _c
from pypy.rlib import objectmodel, debug
from pypy.rpython.annlowlevel import llhelper
from pypy.tool.staticmethods import StaticMethods


class StackletGcRootFinder:
    __metaclass__ = StaticMethods

    def new(thrd, callback, arg):
        h = _c.new(thrd._thrd, llhelper(_c.run_fn, callback), arg)
        if not h:
            raise MemoryError
        return h
    new._annspecialcase_ = 'specialize:arg(1)'

    def switch(thrd, h):
        h = _c.switch(thrd._thrd, h)
        if not h:
            raise MemoryError
        return h

    def destroy(thrd, h):
        _c.destroy(thrd._thrd, h)
        if objectmodel.we_are_translated():
            debug.debug_print("not using a framework GC: "
                              "stacklet_destroy() may leak")

    is_empty_handle = _c.is_empty_handle

    def get_null_handle():
        return _c.null_handle


gcrootfinder = StackletGcRootFinder    # class object
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.